The next major version of Laravel is version 10, which is scheduled to release on February 7th, 2023. Previous versions of Laravel have set a bar and that is the reason, Laravel’s users have huge expectations from the upcoming version.
Before Laravel 9, each major version used to release every 6 months. But Laravel 9 onwards makers have decided to go for annual major releases. Laravel 9 was released on February 8th, 2022, and now the new major release is planned for exactly one year after the previous release.
There will be many changes coming with this new version of Laravel PHP framework and several new additions must have happened. Though the release has still a few months’ time, you must know what will be new with Laravel 10 and how you need to prepare for it.
We’ve tried curating important updates about the forthcoming Laravel version 10. However, the coming weeks will show more updates. Thus, keep reading and stay updated on Laravel 10.
How will you install Laravel 10?
It is simple, Laravel installer has a dev flag that installs the master branch from the Laravel repository.
laravel new hello-world—dev
If you wish to use Composer, then
composer create-project—prefer-dist laravel/laravel laravel-dev dev-master
Laravel 10: New Features
1. Laravel 10 will not support PHP 8.0
With the upcoming version of Laravel, you will not find PHP <= version 8.0. Now the minimum requirement is PHP 8.1 for Laravel 10. Thus, you can expect PHP 8.1 features used in the Laravel framework, for example, readonly properties.
YOU MAY ALSO LIKE: PHP 8.2 Improvement and Deprecations
2. Native type declarations in Laravel 10 skeleton
The Application Skeleton Code will have Native type declaration in Laravel 10. It implies any code in userland generated by the framework will have type-hints and return types. The new types will be added advantages for new project creations.
The types are being added in the framework thoughtfully so that they bring the latest PHP type-hinting features to the Laravel projects and that too without breaking backward compatibility. Some of the features are:
- Return types
- Method arguments
- Redundant annotations are removed where possible
- Allow user land types in closure arguments
- Does not include typed properties
3. Invokable validation rules are by default in Laravel 10
Now in Laravel 10, you will find invokable validation rules are default and when you create a new validation rule through artisan, it will look like this:
# Laravel 9 creates a rule class that implements the #Illuminate\Contracts\Validation\Rule interface artisan make:rule Uppercase # Laravel 9 flag to create an invokable and implicit rule artisan make:rule Uppercase --invokable artisan make:rule Uppercase –invokable --implicit #Laravel 10 creates an invokable rule by default artisan make:rule Uppercase #Laravel 10 implicit rule Artisan make:rule Uppercase –implicit
4. Laravel 10 dropped support for Predis version 1
If your project is using the Predis version 1, you have to upgrade it to version 2 now.
Or else, instead of using Predis, you can consider using PHP’s native Redis extension. This extension is faster, which will boost the speed of your website when the traffic is maximum.
5. dispatchNow() has been removed from Laravel 10
Laravel had a popular method, which is dispatchNow(). This method was deprecated in Laravel 9 in favour of dispatchSync() and now it has been removed in Laravel 10. So, you should now remove it from all your projects.
Deprecations in Laravel 9 and removal from Laravel 10
Whichever method is marked as deprecated in Laravel 9 is removed from Laravel 10. The release upgrade guide of Laravel 10 will outline all the deprecated methods, potential impact assessment, and upgrade guidelines.
Here are a few deprecations found in the comparison of the Laravel framework’s master branch and 9.x branch:
Remove various deprecations Pull Request #41136
Remove deprecated dates property in Pull Request #42587
Remove handleDeprecation method in Pull Request #42590
Remove deprecated assertTimesSent method Pull Request #42592
Remove deprecated ScheduleListCommand’s $defaultName property 419471e
Remove deprecated Route::home method Pull Request #42614
Remove deprecated dispatchNow functionality Pull Request #42591
Do you know, you can contribute to Laravel 10?
The pull requests will let you know what is already been done in the new version. If you are facing any pain point with the framework, you are allowed to create its solution.
Send the PR over to the laravel/framework repository, collect feedback, improve, and get merged.
Please note, your solution will get merged only if it is out-of-the-box and practical to manage.
Since Laravel 10 will release in February 2023; thus, there is ample time for more new features and announcements. Above mentioned new features and deprecations are only some of them.
Skynet Technologies is Laravel news partner. So, keep reading our articles for further updates on the upcoming Laravel 10. Skynet Technologies also provide custom Laravel development services such as Laravel enterprise solution, Restful App development, Laravel upgrades, Laravel migration, and more suitable for small to large scale business across all the industries. You can hire experienced Laravel developer or contact at firstname.lastname@example.org. Fill out form below to request a free quote.
- Laravel Version Update