Laravel 11, released on March 12, 2024, introduces a variety of significant features and enhancements aimed at improving developer efficiency and streamlining application structure. Here are the key updates:
Major Changes and Features
1. Revamped Application Skeleton
Laravel 11 features a slimmer application skeleton, removing unnecessary folders and files to create a more streamlined project structure. Notable removals include the `app/Console`, `app/Exceptions`, and `app/Http/Middleware` directories. The main configuration for routing and middleware is now centralized in the `bootstrap/app.php` file, simplifying the management of application components[1][4][5].2. Optional API and Broadcasting Routes
By default, Laravel 11 does not include API and broadcasting route files. Developers can add these functionalities as needed using Artisan commands:- `php artisan install:api` for API routes
- `php artisan install:broadcasting` for broadcasting routes[1][2].
3. New Health Check Route
A new `/up` health route has been introduced, which triggers a `DiagnosingHealthEvent`. This feature is designed to facilitate uptime monitoring for applications[2][4].4. APP_KEY Rotation
Laravel 11 enhances security with a new method for rotating the `APP_KEY`. This feature allows developers to change their encryption keys without breaking existing encrypted data, utilizing an `APP_PREVIOUS_KEYS` environment variable[2][3].5. Removal of Console Kernel
The Console Kernel has been removed, allowing developers to define console commands directly in `routes/console.php`, streamlining command management[2][5].6. New Artisan Commands
A series of new Artisan commands have been added to improve code generation:- `php artisan make:class`
- `php artisan make:enum`
- `php artisan make:interface`
- `php artisan make:trait`
These commands help automate the creation of common code structures, enhancing productivity[2][3].
7. Eager Load Limit Feature
Laravel 11 introduces an eager load limit feature, allowing developers to limit the number of related models loaded with a query, thereby optimizing performance[2].8. Dumpable Trait
A new `Dumpable` trait is introduced to replace the traditional `dd()` and `dump()` methods in many framework classes, improving debugging capabilities[4][5].9. Testing Framework Change
The default testing framework has shifted to Pest, based on community feedback, making it the primary choice for new Laravel applications[4].10. Database Changes
Laravel 11 now defaults to SQLite as the primary database for new projects, simplifying local development setup. Additionally, it requires SQLite version 3.35.0 or greater[2][4].Conclusion
Laravel 11 emphasizes a cleaner, more efficient development experience by reducing boilerplate code and enhancing the framework's flexibility. These updates not only streamline the initial setup of applications but also improve ongoing maintenance and scalability. Developers are encouraged to explore these new features to leverage the full potential of Laravel 11 in their projects[1][3][5].Citations:
[1] https://benjamincrozat.com/laravel-11
[2] https://laravel-news.com/laravel-11
[3] https://wpwebinfotech.com/blog/what-is-new-in-laravel-11/
[4] https://laraveldaily.com/post/laravel-11-main-new-features-changes
[5] https://kinsta.com/blog/laravel-11/