Marked as March 12, 2024
Laravel 11 has arrived with a leaner and more efficient codebase, shedding approximately 69 files compared to its predecessor.
Let's summarize the main features and changes:
- Slim Skeleton
Laravel 11 introduces a more minimalistic application skeleton, with changes in the folder structure. Notable changes include the removal of folders like
app/Console
,app/Exceptions
, andapp/Http/Middleware
. Changes have been made so thatroutes
,middlewares
, andexceptions
are now registered in thebootstrap/app.php
file. - Config Changes
Several config files have been removed from the
config/
folder, but you can manually publish them using thephp artisan config:publish
command. Additionally, some config values have been removed in favor of automation within the framework. - Welcome Page
Laravel 11 with a new welcome page, featuring light and dark mode options which have vibrant backgrounds, clean icons, and four main sections/links for documentation, Laravel News, Laracasts, and prominent ecosystem links.
- Casts Method
Casts are now declared within the
casts()
method instead of the$casts
property in models, offering improved organization and flexibility. - Artisan Commands
Laravel 11 introduces a new
make:
artisan commands for creatingenum
,interface
,trait
, andclass
and providing more versatility in code generation. - Health Endpoint
A new health check route,
/up
, is now registered in Laravel 11, offering insight into application response times. - Dumpable Trait
A new Dumpable trait is introduced, designed to simplify code debugging by replacing traditional methods like
dd()
anddump()
. - Once() method
Introduces a new memoization function called
once()
to ensure a callable is only called once. - Route Changes
Laravel 11 does not include
routes/api.php
by default, and Sanctum isn't installed automatically. You can usephp artisan install:api
andphp artisan install:broadcast
commands to set up the API scaffolding and broadcasting. - APP_KEY Rotation
Laravel 11 introduces graceful rotation so
APP_KEY
that changes to the key do not disrupt database operations, mitigating the risk of data corruption. - Limit Eager Load
Laravel 11 enables the native limiting of eagerly loaded records without the need for external packages, streamlining data retrieval processes.
- Prompt Validation
The integration of Prompt Validator brings user-friendly forms to command-line applications, boasting browser-like features such as placeholder text and validation support.
- Minimum PHP 8.2
Laravel 11 mandates a minimum PHP version of 8.2, dropping support for PHP 8.1.
Any Question / Leave a comment ?
--- Thank you for your attention! ---