What will include Laravel 11
However, it was unexpected for the Laravel developer community, it was made a decision not to make an official release of Laravel 11 before the beginning of the first quarter of 2024. At the same time, Taylor Otwell - creator of Laravel - during a keynote presentation he delivered at the Laracon conference, informed about some major improvements in the new version of the framework. Despite a delay in the release, a community of developers is looking forward to an upgraded Laravel that will bring some innovations and functions according to the delivered information. Devnrise company based in Riga are offering Laravel development services.
Optimized catalogue structure
Developers have announced the beta version of the optimized catalogue structure. However, there are possible changes in future at the moment it shall be expected as follows:
By default, there are no extensions of controllers.
Middleware is not stored anymore in a specially designated catalogue. Laravel includes nine such software units, the majority of them will not be used by you. However, in case you decide to adjust middleware you will need to transfer the corresponding file to App/ServiceProvider.
public function boot(): void
{
EncryptCookies::except(['some_cookie']);
}
Change of the model
Redistribution of models now is considered as a method, not as an attribute. When the model is redistributed as the method it allows one to make other actions, for example, requests for other methods directly from redistributed objects.
protected function casts(): array
{ return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'options'=› AsEnumCollection::of(UserOption::class),
];}
Configuration change
Laravel has a variety of configuration files but starting with Laravel 11 all those files will be deleted and all configuration parameters will be cascaded. Now you can install all parameters in .env file that is extended to include all settings. Besides that, the new command config:publish allow you to restore any configuration you want, as well as delete any data you do not want to adjust and set because of the new cascade function.
Reducing migration by default
After launching the new application of Laravel it will contain defined migrations by default with 2014 and 2019 dates. However, all those dates will be deleted and transferred into two new files.
PHP 8.2. Minimal support
Now for Laravel 11 application is necessary at least a PHP 8.2 version. In case of use of older PHP version, it is strictly suggested to update it without delay. Despite the fact that Laravel 11 options are considered beta versions, all those options were developed for working process improvement. It is important to note that there still may occur any unexpected changes so we will update this post after the announcement of the new functions.
Named arguments
According to the Laravel recommendations via backward compatibility usage of named arguments is considered as inappropriate praxis. If it’s necessary we can rename function arguments according to Laravel requirements to improve the code base. To avoid future problems taking into account changes in the parameters, request calls for Laravel methods using named arguments should be implemented carefully and any decision made must be based on a deep understanding of parameter name changes.