Laravel 10 is now released, including a minimum version of PHP v8.1, a new Laravel Pennant package, callable validation rules, native type declarations and more…
Laravel release schedule
Before Laravel 9, major framework releases were released twice a year, or roughly every six months. Starting with Laravel 9, the core team transitioned to an annual schedule and shipped Laravel 9 in February 2022 (instead of the originally planned September 2021):
Laravel leverages a variety of community-driven packages, as well as nine symfony components for a range of functionality within the framework. Symfony 6.0 is scheduled for release in November. Because of this, we decide to delay the release of Laravel 9.0 to 2022.
The release delay allows us to upgrade our underlying Symfony components to Symfony 6.0 without having to wait until September 2022 to perform this upgrade. It also puts us in better position for future releases, as our annual releases always come two months after Symfony’s releases.
This future schedule is one major release per year:
- Laravel 9: February 8, 2022
- Laravel 10: February 14, 2023
- Laravel 11: Q1 2024
Laravel 9 will continue to receive bug fixes until then August 8, 2023 and security updates until February 14, 2024.
Until then, you can expect bug fixes for Laravel 10 August 6, 2024 and security updates until February 14, 2025.
Let’s check out some of the big new features in Laravel 10:
Laravel 10 drops support for PHP 8.0
The 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 assume that 8.1 features used in the framework, such as such as read-only properties.
Laravel Pennant is a package built by the Laravel team that comes with Laravel 10 and provides feature flags for your applications.
Using feature flags, you can safely incrementally introduce new application features, A/B test new interface designs, complement a trunk-based development strategy, and more.
This package is the latest in the line of official packages provided by the core team and means we now have a well built and tested package that gives us some great features.
Process layer for Laravel
The Laravel Process service makes testing and running CLI processes a dream experience.
$result = Process::run('ls -la');
The process layer includes extensive out-of-the-box functionality, such as:
- Fluent process methods to create a process instance before running it
- Process processing of the output as soon as it is received
- Asynchronous Processes
- process pools
- Extensive test functions via
- Preventing stray processes during tests
Testing processes have never been easier.
Native type declarations in the Laravel 10 skeleton
In Laravel 10, the application skeleton code has native type declarations. This means that any framework-generated code in userland has type hints and return types. In our article we will address the caveats of this approach and we believe that you will like the additional types when creating new projects in the future.
Types are added in a way that brings the latest PHP type hinting capabilities to Laravel projects without breaking framework-level backwards compatibility:
- return types
- method arguments
- Superfluous annotations will be removed where possible
- Allow userland types in closing arguments
- Contains no typed properties
Callable validation rules are the default
Starting with Laravel 10, callable validation rules are now the default. When you create a new validation rule through Artisan, you can expect the following:
# 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
Profile option for testing
A new feature for Laravel 10 is a
--profile Option that makes it easier for you to find slow tests in your application.
--profile This option is meant to help keep your tests fast and help you either fix the slow tests or group them better so you don’t have to run them all the time.
New string password helper
Str::password The method can generate a secure, random password of a specified length. The password consists of a combination of letters, numbers, symbols and spaces. By default, passwords are 32 characters long:
$password = Str::password();
$password = Str::password(12);
Deprecations of Laravel 9
Methods deprecated in Laravel 9 will be removed in Laravel 10. We can assume that the release upgrade guide describes all the deprecated methods, possible impact assessments and ways to upgrade just before release.
Here are some downgrades found comparing the Laravel frameworks
master turnoff to
9.x Industry at the time of writing:
Testing Laravel 10
If you want to start testing Laravel 10 now, you can install it into a new project using
laravel new <your-project-name> --dev
Upgrade to Laravel 10
The easiest way to upgrade is to use Laravel Shift. This allows you to automatically keep your application up to date or follow the upgrade guide.
You can also visit the official release page to check for updated information as it becomes available.