Laravel 11: No Http Kernel, No $casts, No Console Kernel!
Laravel 11 is scheduled for release in Q1 2024, bringing various improvements and new features to the framework.
It’s a good practice to always know about new version features and changes to prevent breaking application by update to new framework version.
Taylor Otwell mentioned Laravel 11 will have a slim skeleton and there are many changes in the new version, which we are going to review them.
1. No Http Kernel
Since Laravel 11, there is no more Http Kernel file in Http
folder and all necessary configurations have been moved to the bootstrap/app.php
file.
If we navigate to bootstrap folder and look at app.php
file we will see:
We should write any further modification here and it is identical to the old Http/Kernel
file.
2. No $casts
In Laravel 11, we can not use $casts
attribute in models anymore. In earlier versions of the framework we used to cast desired attribute like below:
But after upgrading your framework version to 11.0, we should use cast function in our models to cast attributes. For example:
3. No Console Kernel
Another notable change in Laravel 11 is the deletion of console kernel.php
file. By using Laravel 11, we should put all of our commands inside routes/console.php
as shown below:
4. Config Changes
Some of the config files were previously stored in the config
folder will be hidden in Laravel 11. If you need them, you can use php artisan config:publish
command to reveal and modify them.
5. Api File
Once again, the api.php
file is not placed in web folder by default and you need to run php artisan install:api
to bring in API routes file.
That’s it for now but this story will be update until three months after Laravel 11 release date, So if you want to be aware of the following changes in the future be sure to save this article and follow me!
Thanks, peace!
ALSO READ: