Laravel 11, the most recent version of the popular PHP framework, maintains its reputation of offering significant changes, new features, and speed improvements. This release prioritises developer experience, security, and performance, making it more powerful and efficient for creating modern online applications. Here's a full look at Laravel 11's new features and upgrades.
At a glance Laravel 11
Version | Laravel 11 |
Release Date | March 12th, 2024 |
Bug fixes | Until Sep 3rd, 2025 |
Security fixes | Until Mar 12th, 2026 |
Minimum PHP | version 8.2 |
Laravel 11 now requires PHP 8.2 as a minimum version, taking advantage of new features and performance improvements. These include but are not limited to read-only properties, enumerations, and first-class callable syntax, ensuring the framework remains at the cutting edge of PHP development.
Laravel 11 improved the default application structure by lowering the number of default files. This includes fewer service providers, middleware, and configuration files, making new Laravel applications more lightweight and manageable. This update does not need Laravel 10 apps moving to Laravel 11 to change their structure. This ensures backward compatibility.
app/
├── Http/
│ └── Controllers/
│ └── Controller.php
├── Models/
│ └── User.php
└── Providers/
└── AppServiceProvider.php
bootstrap/
├── app.php
└── providers.php
config
...
In Laravel 11, here are new artisan commands introduced.
php artisan make:class
php artisan make:enum
php artisan make:interface
php artisan make:trait
In Laravel 11, a new health routing directive was added, allowing the framework to establish a simple health-check endpoint. This endpoint can be accessed by third-party health monitoring services or orchestration systems, such as Kubernetes, to ensure the application is operational. By default, this health-check route is accessible at /up
and config in bootstrap/app.php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
Laravel 11 introduces automatic password recalculation during authentication if the hashing algorithm's work factor is changed, improving security without breaking your application. Developers can disable this feature by adding the rehash_on_login
option to their config/hashing.php
(Laravel) configuration file.
A new dumpable trait is introduced. This is intended to streamline the core of the framework, as several classes currently have dd
or dump
methods, and also allows you to use this Dumpable functionality in your own classes.
use Illuminate\Support\Traits\Dumpable;
class MyClass
{
use Dumpable;
// ...
}
For clean Laravel 11 file structure most of the config files are removed from config directory. You can get those files by these commands.
php artisan config:publish
Starting with Laravel 11, SQLite is the default database and Pest is the default testing framework. While SQLite is a simple database and is a better choice for the default database in modern Laravel applications, Pest offers simpler syntax and better test readability.
Laravel 11 introduces native support for bulk loading record limiting, removing the need for external packages to achieve this functionality. This improvement allows developers to limit the number of associated model datasets that are eagerly fetched, improving performance and resource management within their applications.
User::select( 'id', 'name' )->with([
'articles' => fn($query) => $query->limit(5)
])->get();
Read more about laravel 11 release note.
Laravel 11 introduces many new features and improvements, making it a more powerful tool for web developers. The focus on efficiency, security, and developer experience keeps Laravel at the forefront of PHP development today. Whether you're developing a small application or a large business solution, Laravel 11 provides the tools and features you need to create perfect, reliable web applications.