Laravel is a popular PHP framework known for its developer-friendly features. Laravel 11, the latest version, is on the horizon, promising exciting updates. In this article, we'll explore Laravel 11's release date and its new features, showing you what's in store for web developers.
Laravel is a PHP framework used by many web developers to create powerful and efficient web applications. With each new version, Laravel introduces new features and improvements, making it a preferred choice for many.
Laravel 11, the latest release, is generating a lot of excitement as it promises even more enhancements and capabilities.
In this article, we will dig deeper into what's coming with Laravel 11. We'll not only find out when it's going to be released but also explore the features and updates it's expected to bring.
This means we'll take a closer look at the tools and functionalities that Laravel 11 will offer to developers. It's a great opportunity for web developers to get ahead of the curve and discover how this new release can benefit their web development projects.
So, let's get ready to explore Laravel 11 in detail and see how it can elevate your web development journey
Whether you're a seasoned Laravel artisan or just venturing into the realm of web development, Laravel 11 is bound to capture your imagination and propel your projects to new heights.
So, let's dive in and uncover the innovations that await us in this remarkable release.
According to the Support Policy, Laravel 11 is scheduled to be released on February 6th, 2024.
The release of Laravel 11 doesn’t mean you have to update all your projects immediately, though.
The framework last had LTS (Long-Term Support) in version 6, but each major version has two years of updates, which should give you enough time to get your codebase in check and upgrade it.
Laravel 10 will receive bug fixes until August 6th, 2024, and security fixes until February 4th, 2025.
Version | PHP | Release | Bug fixes until | Security fixes until |
---|---|---|---|---|
10 | 8.1 | February 14, 2023 | August 6th, 2024 | February 4th, 2025 |
11 | 8.2 | Q1 2024 | August 5th, 2025 | February 3rd, 2026 |
Laravel 11 is not scheduled to be released until the end of the year, but some new features have been shared out.
This was an early decision, but Laravel 11 apps now require a minimum of PHP 8.2. If you are currently running an older version of PHP, it's an opportune time to consider upgrading.
In light of the upcoming Laravel 11 release, the development team has taken an early but decisive step by raising the minimum PHP version required to PHP 8.2. This move reflects the framework's commitment to embracing the latest advancements in PHP and ensuring that Laravel developers can leverage the full potential of the language.
By mandating PHP 8.2, Laravel 11 is poised to take advantage of the newest features, performance improvements, and security enhancements introduced in the latest PHP releases.
This aligns with the Laravel philosophy of providing developers with the best tools and resources to build robust and cutting-edge web applications.
As of now, these features are in the beta preview stage and are subject to change. However, here's a glimpse of what you can expect in Laravel 11:
Controllers without Default Extension: In Laravel 11, controllers will no longer extend anything by default. This change aims to provide developers with more flexibility in defining controller classes and their inheritance.
Middleware Directory Removal: The middleware directory will no longer be present in Laravel 11. Currently, Laravel ships with nine middleware, and most of them are not typically customized by developers. To customize middleware in Laravel 11, you will instead use the App/ServiceProvider.
For example:
public function boot(): void
{
EncryptCookies::except(['some_cookie']);
}
Most of the things you used to could do in the Kernel you can now do in the Bootstrap/App.
return Application::configure()
->withProviders ()
-›withRouting(
web: __DIR__.'/../routes/web.php'
commands: __DIR__.'/../routes/console.php',
)
->withMiddleware(function(Middleware Smiddleware) {
$middleware->web(append: LaraconMiddleware::class):
})
In Laravel 11, there has been a significant shift in how certain functionalities are handled, moving them from the Kernel to the Bootstrap/App. This change provides developers with a more streamlined and organized approach to configuring various aspects of the application.
Model casts are now defined as a method instead of a property. When defined as a method we can do other things, like call other methods directly from the casts. Here is an example using a new Laravel 11 AsEnumCollection
:
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'options'=› AsEnumCollection::of(UserOption::class),
];
}
See the pull request on GitHub: [11.x] Adds Model::casts() method and named static methods for built-in casters
Laravel has previously utilized numerous configuration files, but with Laravel 11, these files have been removed, and now all configuration options cascade down. The .env
file has been expanded to encompass all the settings you might need to configure.
To complement this change, a new config:publish
the command has been introduced, enabling you to retrieve any configuration file you may wish to restore. However, the new cascade feature grants you the flexibility to omit any options you do not wish to customize, simplifying the configuration process.
In Laravel 11, when you create a new Laravel application, the default migrations from the years 2014 and 2019 will undergo a significant reorganization. Instead of being spread across multiple migration files, these migrations will be consolidated into just two files.
With this change, developers starting a new Laravel project will have a cleaner and more streamlined database/migrations
directory, enhancing the overall development experience and project maintainability.
In Laravel 11, the default route file structure will undergo a significant change to enhance simplicity and modularity. By default, there will be only two route files: console.php
and web.php
. This approach aims to provide a cleaner starting point for new Laravel applications.
Furthermore, API routes will no longer be included by default in the application's route files. Instead, developers will have the option to opt-in to API routes and Laravel Sanctum by using the command php artisan install:api
.
When running this command, Laravel will generate an API routes file, and if required, set up Laravel Sanctum for secure API authentication.
Similarly, WebSocket broadcasting will also follow the opt-in approach. To include WebSocket broadcasting functionality, developers can use the command php artisan install:broadcasting
.
This will create the necessary configuration and setup for enabling WebSocket broadcasting in the application. These changes represent a shift towards a more modular and customizable application structure.
The Console Kernel is being removed, and you'll be able to instead define your console commands right in routes/console.php
.
In Laravel 11, the Console Kernel is being removed as a separate entity, and a new approach to defining console commands is being introduced. Instead of having a dedicated Console Kernel file, developers will define their console commands directly in the routes/console.php
file.
The routes/console.php
file, which was traditionally used for defining Artisan commands as closures, will now serve as the primary location for registering all console commands.
This change aims to simplify the structure of Laravel applications and provide a more straightforward and consolidated way to manage console commands.
By eliminating the Console Kernel and moving the command definitions to routes/console.php
, Laravel streamlines the application's configuration and reduces unnecessary files.
This new approach allows developers to have a clear and centralized view of all console commands, making it easier to maintain and manage them throughout the development process.
Here is a list of every merged PR I found to prepare the Laravel 11 release:
You might also like: