Laravel 11 is released
Laravel 11 has been officially launched, bringing along several exciting enhancements. Among the notable updates is the requirement for a minimum PHP version of 8.2, ensuring compatibility with the latest features and optimizations. Additionally, a new Laravel Reverb package has been introduced to Laravel's suite of first-party tools. Moreover, users can expect a streamlined directory structure, contributing to a more organized and efficient development process. These advancements collectively contribute to making Laravel 11 a compelling choice for web development projects, offering improved performance, functionality, and developer experience.
Official GitHub: https://github.com/laravel/laravel
Laravel Reverb
Reverb, a WebSocket server designed for Laravel applications, is built to enable real-time communication between clients and servers. Its optimized performance ensures effective operation, allowing a single server to manage thousands of connections and transmit data without the delays and inefficiencies of traditional HTTP polling methods. Reverb uses the Pusher protocol for WebSockets, making it immediately compatible with Laravel broadcasting and Laravel Echo.
Streamlined directory structure
Laravel 11 adopts a practical and minimalistic approach, enhancing efficiency. Moving from Laravel 10 to Laravel 11 is straightforward, requiring no structural changes. Upon installation, you'll notice a cleaner workspace with fewer files. In Laravel 11, controllers no longer have default settings, and the middleware directory is no longer present. Customization options are now available within the App/ServiceProvider directory.
No more kernels
Many tasks that were traditionally performed in the HTTP Kernel can now be done within 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):
});
The Console Kernel is also being removed. You'll be able to define your console commands right in routes/console.php.
New dumpable trait
Although the Dumpable trait is a new addition in Laravel 11, it essentially consolidates the functionalities of dump() and dd() into a reusable trait. This eliminates the need for classes to manually implement these functionalities. Application developers and package authors can also benefit from this new illuminate/support trait to easily incorporate debugging methods into chainable classes.
class Stringable implements JsonSerializable, ArrayAccess
{
use Conditionable, Dumpable, Macroable, Tappable;
str('foo')->dd();
str('foo')->dump();
}
Routes changes
As a default setting, Laravel 11 will include only two route files: console and web. Enabling API routes will now be an opt-in process through php artisan install:api, providing access to the API routes file and Laravel Sanctum. Similarly, for WebSocket broadcasting, you can activate it using php artisan install:broadcasting.
Additionally, Laravel 11 introduces a new /up health route that triggers a DiagnosingHealthEvent, enhancing integration with uptime monitoring solutions.
Config changes
Laravel typically includes numerous config files, but Laravel 11 simplifies this process by merging them and enabling all config options to cascade down. The .env file has been expanded to accommodate all the necessary options.
New Artisan commands
New Artisan commands have been introduced to facilitate the creation of classes, enums, interfaces, and traits.
php artisan make:class
php artisan make:enum
php artisan make:interface
php artisan make:trait
0 Comments