Laravel 10 is now released!
Published on by Paul Redmond
Laravel 10 is now released, including a minimum PHP v8.1 version, a new Laravel Pennant package, invokable validation rules, native type declarations, and more...
Laravel Release Schedule
Before Laravel 9, major framework versions were released twice a year or roughly every six months. Starting with Laravel 9, the core team went to an annual schedule, shipping Laravel 9 in February of 2022 (instead of the originally planned September 2021):
Laravel uses a variety of community-driven packages as well as nine Symfony components for a number of features within the framework. Symfony 6.0 is due for release in November. For that reason, we are choosing to delay the Laravel 9.0 release until 2022.
By delaying the release, we can upgrade our underlying Symfony components to Symfony 6.0 without being forced to wait until September 2022 to perform this upgrade. In addition, this better positions us for future releases as our yearly releases will always take place two months after Symfony's releases.
This schedule going forward is one major release annually:
- Laravel 9: February 8th, 2022
- Laravel 10: February 14th, 2023
- Laravel 11: Q1 2024
Laravel 9 will continue to get bug fixes until August 8th, 2023 and security fixes until February 14th, 2024.
You can expect Laravel 10 bug fixes until August 6th, 2024 and security fixes until February 14th, 2025.
Let's look at some of the big new features in Laravel 10:
Laravel 10 drops support for PHP 8.0
Laravel framework will drop support for PHP <=v8.0
in Laravel 10. The minimum required version is PHP ^8.1
. Browsing the comparison between master and 9.x, we can expect to see 8.1 features used in the framework, such as readonly properties.
Laravel Pennant
Laravel Pennant is a package created by the Laravel team that will arrive with Laravel 10 and provides Feature Flags for your applications.
Feature flags enable you to incrementally roll out new application features with confidence, A/B test new interface designs, compliment a trunk-based development strategy, and much more.
This package is the latest in the lineup of official packages provided by the core team and means that we now have a well-built and well-tested package that provides us with some great functionality.
Process layer for Laravel
The Laravel Process service makes testing and running CLI processes a dream to work with.
use Illuminate\Support\Facades\Process; $result = Process::run('ls -la'); $result->successful();$result->failed();$result->exitCode();$result->output();$result->errorOutput();$result->throw();$result->throwIf($condition);
The Process layer includes rich features out of the box, such as:
- Fluent process methods to build a process instance before running it
- Process output handling as it is received
- Asynchronous processes
- Process Pools
- Rich testing features via
fake()
- Preventing stray processes during tests
Testing processes has never been easier.
Native type declarations in Laravel 10 skeleton
In Laravel 10, the Application Skeleton Code Will Have Native Type Declarations. This means that any code in userland generated by the framework will have type-hints and return types. Our article discusses the caveats around the approach, and we think you will love the added types when creating new projects in the future.
Types are being added in a way that brings the latest PHP type-hinting features to Laravel projects without breaking backward compatibility at the framework level:
- Return types
- Method arguments
- Redundant annotations are removed where possible
- Allow user land types in closure arguments
- Does not include typed properties
Invokable Validation rules are the default
Starting in Laravel 10, invokable validation rules are now the default. When you create a new validation rule via artisan, this is what you can expect:
# Laravel 9 creates a rule class that implements the# Illuminate\Contracts\Validation\Rule interfaceartisan make:rule Uppercase # Laravel 9 flag to create an invokable and implicit ruleartisan make:rule Uppercase --invokableartisan make:rule Uppercase --invokable --implicit # Laravel 10 creates an invokable rule by defaultartisan make:rule Uppercase # Laravel 10 implicit ruleartisan make:rule Uppercase --implicit
Profile option for tests
A new feature coming to Laravel 10 is a --profile
option that will make it easy for you to find any slow tests in your application.
This --profile
option should help keep your tests fast and help you either fix the slow tests or to better group them to make it easier not to run them all the time.
New String Password helper
The Str::password
method can generate a secure, random password of a given length. The password will consist of a combination of letters, numbers, symbols, and spaces. By default, passwords are 32 characters long:
use Illuminate\Support\Str; $password = Str::password(); // 'EbJo2vE-AS:U,$%_gkrV4n,q~1xy/-_4' $password = Str::password(12); // 'qwuar>#V|i]N'
Deprecations from Laravel 9
Methods marked as deprecated in Laravel 9 are being removed in Laravel 10. We can expect the release upgrade guide to outline all the deprecated methods, potential impact assessment, and how to upgrade closer to the release.
Here are some deprecations found in the comparison of the Laravel framework's master
branch to the 9.x
branch at the time of writing:
- 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
Testing Laravel 10
If you want to start testing Laravel 10 now, you can install it in a new project by using the --dev
flag:
laravel new <your-project-name> --dev
Upgrading to Laravel 10
The easiest way to upgrade is to utilize Laravel Shift and it can automate always keeping your application up to date, or follow the upgrade guide.
And More...
You can also check out the official releases page to look for updated information as it becomes available.