COFSO : Nurture your ideas with us.

Blog Details

All You need to know about the new Laravel 11

All You Need To Know About The New Laravel 11

Exciting information, the new version of Laravel, Laravel11 is planned to be released in the first quarter of 2024 which is on the first or second week of February 2024. The new version is packed with a wide variety of features including a change in the default directory structure. To begin with the new Laravel11 you must need a PHP 8.2 version at the minimum and if you are using SQLite, then you will need SQLite 3.35.0 or above version. Not to mention all this information is based on the beta preview they might make changes in the final release. As of now, these are the changes that you can expect.

App Directory Changes

The console and Exception directories are removed from the APP directory, yes you heard it right. In the latest release, the App directory will contain only HTTP, model and Providers. Also, the HTTP directory will have only a controller.php file, middleware is removed from the HTTP directory and moved to APP/ServiceProvider.

laravel

Image by Laravel

No more HTTP/Kernel

When it comes to Laravel11 the kernel is removed from the HTTP directive and is now placed inside the Bootstrap/App directory.

Model Changes

There's a change in how model casts are defined. Instead of defining them as a property (like a variable), they are now defined as a method. By defining model casts as a method, developers can now do more than just specify the casting behaviour. They can perform additional actions or call other methods directly from within the casts method.

Dumpable Trait

Currently, we have “dd” or “dump” methods for debugging purposes like displaying information about the state or content of certain objects or variables, now you can use the ‘Dumpable’ trait in your class you can include this trait to have access to the “dd” or “dump” methods.

Config Changes

Now inside the config directory, we can find so many files which are not even necessary by default these will be removed in Laravel11, but if you like to bring them back you can always do that using the command ‘php artisan config:publish’.

Image by Laravel

Migration Changes

By default, Laravel has four migration files and the data contains dates 2014, and 2019 in the data now the migration files are reduced to just three files and also the dates are removed from the migrations of the new version.

Image by Laravel

No more Console Kernel

In the latest version of Laravel kernel is removed from App/Console and the console can now be found on ‘Route/console.php’.

Route Changes

By default, the Laravel11 will only have web.php and console.php files in the route directory, api.php and channel.php files are removed. Not to worry, if you like to include the Api.php then simply run the command ‘php artisan install:api’. Same with WebSocket broadcasting, use the command ‘php artisan install:broadcasting’.

Image by Laravel

Named Arguments

Be careful while using named arguments, the names of these arguments might change in the future as Laravel get updated. They may choose to rename function arguments to improve the Laravel codebase.

According to the information gathered from the latest sources you can expect changes in the directory structure and arguments, it is said that the number of files is reduced to approximately 69, and you will get a clear picture of the structure after the release. As COFSO Technologies, we are eagerly awaiting the new release, excited about the prospect of leveraging these enhancements to create more robust and efficient Laravel applications.