Version | PHP | Release | Bug Fixes Until | Security Fixes Until |
10 | 8.1 | February 14, 2023 | August 6, 2024 | February 4, 2025 |
11 | 8.2 | Q1 2024 | August 5, 2025 | February 3, 2026 |
Quick Summary:
Laravel is the knight in shining armor for business owners prioritizing security for their web application development. Respecting this factor, the core team at Laravel is ready with another bombastic release of the renowned PHP web application framework, Laravel 11. So, here we are again to update you with the latest facts about What’s New in Laravel 11, along with the latest updates and features that you should look forward to for your business. Also, these factors will help you take the final stand on whether you should upgrade your existing Laravel to the latest version.
Following tradition, the latest version of Laravel 11 was released on March 12, 2024, and here we are with everything you should look forward to and expect from it. As we know, the Laravel core team follows the Semantic Versioning methodology, which entails that the framework’s significant updates are released once a year during the first quarter. However, it doesn’t mean your existing applications should be updated immediately to the latest Laravel version.
The Laravel framework was last released (LTS or Long Term Support) in version 6, but each major version possesses two years of updates; this enables enough time to get your existing codebase in check and upgrade it accordingly. According to the official Laravel documentation, Laravel 10 will receive bug fixes until August 6, 2024, and security fixes until February 4, 2025.
Version | PHP | Release | Bug Fixes Until | Security Fixes Until |
10 | 8.1 | February 14, 2023 | August 6, 2024 | February 4, 2025 |
11 | 8.2 | Q1 2024 | August 5, 2025 | February 3, 2026 |
The team at Laravel understands the importance of the latest features and updates being introduced within the system. However, they strive to deliver the best to the developers and the business owners. This is why using the latest version of the framework or its components is always preferred. The same is the case with the latest Laravel v11, which has many updates that can benefit your business under several heads. Let’s proceed with what Laravel 11 has with this year’s latest updates.
The new Laravel version uses SQLite for database storage along with that database driver for Laravel’s session, cache, and queue. Also, creating a project using the composer create-project command or via Laravel installer will automatically create the SQLite file and run the initial database migrations for you.
This will enable you to start building your app immediately after creating a new Laravel app without installing any add-on software or making any additional database migrations.
The first and foremost change that Laravel version 11 will bring is dropping the support for Laravel PHP 8.1. The reason is that the PHP 8.2 will be fully established when Laravel 11 is up for use, and the PHP 8.3 will also be stable. Therefore, with two upgraded versions running within the market, the need for an older version, PHP 8.1, is unnecessary. However, again, it is not a mandate to upgrade to the latest version instantly, but you can take a thorough testing approach. You can update the existing applications gradually, but upgrading to the latest version is a great choice.
Laravel Reverb offers high-speed and scalable real-time WebSocket communication directly to your Laravel applications; this offers seamless integration with Laravel’s existing suite of event broadcasting tools like Laravel Echo.
The Reverb also allows for horizontal scaling using the Redis publish and subscribe features, allowing you to distribute WebSocket traffic across various Reverb backend servers supporting a single, high-demand application.
You can easily set up rate limiting in Laravel, and now, with Laravel 11, you can set the rate limit per second, along with the HTTP requests and queued jobs. Till the previous version, it was limited to per minute:
For the previous version when testing that a queued job was released, deleted or manually failed was a complex task and needed the definition of custom queue fakes and stubs. But, with laravel 11, you can quickly test for these queue interactions using the withFakeQueueInteractions method:
In addition to the assertReleased assertion, which allows you to verify if a job was released back into the queue, you can also use the assertFailed or assertDeleted assertions to determine if a job has failed or been deleted, respectively.
Laravel 11 has a slimmer skeleton. The intent here is to involve less boilerplate code. This approach will benefit the business owners and developers by allowing them to deal with less code, leading to faster development. Talking about the changes made in-depth, they are all as follows:
The core intent behind this pull request is to replace the current dd and dump methods in most Laravel classes, and it will also introduce a new Dumpable trait. Also, the trait enables Laravel users and package authors to utilize debugging methods easily within their class. Let us take a glimpse of an example to use it:
Also, this pull request is intended explicitly for Laravel 11.x as it requires modifications to the signature of several methods. The …$args were added to the debugging methods for consistency across the entire codebase. However, it is still preferred for the Laravel 11.x version.
In the latest version of Laravel, Model casts are now defined as a method instead of a property. When defined as a method, it enables performing other things, such as calling other methods directly from the casts.
Generally, Laravel requires declaring attribute casting in an eloquent model as given below:
However, with Laravel 11, you can easily define your casting through a ‘casts()’ method in your model that offers you a chance to use static methods from class doing the casting as illustrated below:
class User extends Model { protected function casts(): array { return [ 'foo' => AsCollection::using(FooCollection::class), ]; } }
Also, you can now specify your casts as an array, as given below:
class User extends Model { // Even in the old $casts property! protected $casts = [ 'foo' => [AsCollection::class, FooCollection::class], ]; protected function casts() : array { return [ 'foo' => [AsCollection::class, FooCollection::class], ]; } }
The ‘casts()’ method is prioritized over the ‘$casts’ property.
Also, these changes are non-breaking, which will not affect the current code when you upgrade to Laravel 11.
The older versions of Laravel possessed multiple config files, and Laravel v11 has come up with these files removed and all the config options being cascaded down. The ‘.env’ has been expanded to include all the options you want to set or configure.
Further, pairing with Laravel 11 comes with a completely new ‘config:publish’ command that enables you to return any config you need. And, even after bringing them back, the new cascade feature enables you to remove every option you don’t want to customize, thereby ensuring a more streamlined and tailored configuration experience. Considering a typical example, running ‘artisan config:publish database’ generates a dedicated database config. File, precision, and organization at ease.
// To publish all the config files php artisan config:publish // Specific config file php artisan config:publish database
Laravel 11 brings aboard a new once helper method that allows you consistently to achieve the same value irrespective of the number of times you call an object method. This function helps when you have the same code you wish to verify only runs once.
In Laravel v11, when creating a new Laravel application, the default migrations from 2014 and 2019 will be significantly reorganized. Instead of being spread across multiple migration files, these migrations will only be consolidated into two files.
This will allow the developers initiating a new Laravel project to have a cleaner and more streamlined database/migrations directory, enhancing the overall development experience and project maintainability.
Hire Laravel Developers with industry-wide experience to build next-gen Laraval solutions that help you get the best out of your project.
After removing the HTTP Kernel, the Console Kernel is also removed, and in place of that, a new approach is introduced. That means developers will be responsible for defining their console commands directly in the routes/console.php file instead of having a dedicated Console Kernel file.
The routes/console.php file traditionally defined the Artisan commands as closures, but they will now work as the primary location for registering all console commands. This change aims to simplify the structure of Laravel applications and offer a more simplified and consolidated way to manage console commands. By removing the Console Kernel and moving the command definitions to routes.console.php, Laravel aims to streamline the application’s configuration and reduce unnecessary files. This new approach enables the developers to have a clear and centralized view of all the console commands, making it easier to manage and maintain them throughout the development process.
return Application::configure() ->withProviders () ->withRouting( web: __DIR__.'/../routes/web.php' commands: __DIR__.'/../routes/console.php', ) ->withMiddleware(function(Middleware Smiddleware) { $middleware->web(append: LaraconMiddleware::class): })
It is another feature contributed by Taylor Otwell himself. The new version of Laravel includes a health routing directive that guides Laravel in defining a simple health-check endpoint that third-party apps, health monitoring services, or orchestration systems like Kubernetes can invoke. The default status of the third route is a server at /up:
->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', )
Considering the default setting in Laravel, there will be two route files: console.php and web.php. If you wish API routes to be included, you must opt-in by running the ‘php artisan install:api’ that will offer you the API routes file and the Laravel Sanctum functionality.
Similarly, for the websocket broadcasting, you can use the command ‘php artisan install:broadcasting.’ This command will set up the necessary files and configurations crucial for the websocket broadcasting in your Laravel applications. Collectively, these changes will contribute to a radical shift towards a more modular and customizable application structure.
Another feature contributed by Taylor Otwell. With the older Laravel versions, changing the ‘APP_KEY’ led to broken data in the database. This issue is resolved with Laravel 11 as now a new graceful rotation that will NOT break old encrypted data, using an ‘APP_PREVIOUS_KEYS’ comma-delimited list.env variable. This will auto re-encrypt the data using the new key.
It is a PHP package that allows for adding enticing and user-friendly forms to your command-line applications, with browser-like features, including placeholder text and validation. Laravel Prompts now supports input validation via closures:
$name = text( label: 'What is your name?', validate: fn (string $value) => match (true) { strlen($value) < 3 => 'The name must be at least 3 characters.', strlen($value) > 255 => 'The name must not exceed 255 characters.', default => null } );
However, this is complex when dealing with multiple inputs or validation scenarios. Therefore, in Laravel 11, you can use the true power of the Laravel validator to validate the prompt inputs:
Laravel 11 is also dropping the support for Laravel Telescope 4.x. This mandates updating your Laravel Telescope dependency to ^5.0 in our composer.json file.
The Telescope 5.0 thwarts the automatic migrations loading from its own directory. You can run the command given below to publish the Telescope’s migrations within your applications.
Laravel 11 version has also dropped the support for Laravel Sanctum 3.x, which mandates the need for updating your application’s Laravel Sactum dependency to ^4.0 in your composer.json file.
Also, the Sanctum doesn’t automatically load the migrations from its own migrations directory. You can run the command given below to publish Sanctum’s migrations to your application:
Then, within your application’s config/sanctum.php config file, update the references to the authenticate_session, encrypt_cookies, and validate_csrf_token middleware of the following:
'middleware' => [ 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class, 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, ],
Laravel 11 now no longer supports Laravel Spark Stripe 4.x. You can update your application Laravel’s Spark Stripe dependency to ^5.0 within your composer.json file.
Spark Stripe 5.0 doesn’t automatically load migrations from its own migrations directory. Instead, you can run the command given below to publish the Spark Stri[e’s migrations to your application.
Laravel 11 has deprecated the support for Cashier Stripe 4.x. This obligates you to upgrade to Laravel Cashier Stripe dependency to ^15.0 in your composer.json file.
Also, the Cashier Stripe 15.0 doesn’t automatically load migrations from its own migrations directory. In place of that, you can run the command below to publish Cashier Stripe’s migrations to your app:
To install Laravel v11, specify the ‘-dev flag’ during the installation. Laravel can then be programmed to download and install only the master branch from the ‘laravel/laravel’ repository.
However, if you prefer the hands-on installation experience, your go-to choice is a Composer.
For several reasons, you should upgrade your existing Laravel application to the latest Laravel 11 version. As a trusted Laravel Development Partner, Bacancy strives to bring you the benefits of upgrading to the latest Laravel version 11. Let us have a look at it:
If you are an expert in Laravel development, then you can easily give your valuable contribution to the Laravel community and fix the bugs that you have encountered working on your Laravel project, or you can also create and contribute an exceptional new feature in the upcoming version of Laravel v11. The steps to do the same are:
Note: It is essential to consider if you wish your bug-fix feature to be merged. Then, you must add something to the framework that is a win for developers but not a pain for the core team at Laravel or Taylor Otwell in the long run.
This is what the latest version of Laravel v11 has come up with. However, we can expect many features and updates from the core team at Laravel in the future, even after the Laravel 11 release date of March 12, 2024. However, if you are a business owner and are confused about whether you should upgrade to the Laravel 11 version, get in touch with a professional Laravel Development Company like Bacancy to give you a thorough tour of the aspects of your existing Laravel application and the features and functionalities you can leverage with Laravel 11 to help you make a clear choice if upgrading to Laravel latest version is your ideal decision to make.
Laravel v11 is the latest version of the renowned PHP framework Laravel. The latest Laravel 11 version was released on March 12, 2024.
Yes, to the most extent, Laravel 11 is backward compatible with the previous versions of Laravel. However, some features may require upgrading to the latest version of Laravel, Laravel version 11.
No, the Named Arguments are not covered by the Laravel backward compatibility guidelines. We can choose to rename the function arguments when it is crucial to improve the Laravel codebase. Therefore, it is advisable to use the named arguments cautiously when calling Laravel methods and with a proper understanding that the parameter names can change in the future.
Your Success Is Guaranteed !
We accelerate the release of digital product and guaranteed their success
We Use Slack, Jira & GitHub for Accurate Deployment and Effective Communication.