Written by Giles Bennett
Now that Laravel has moved to a regular annual release schedule, with the new version arriving in February of each year, the gloom of January is at least lightened someewhat by the prospect of a new release on the horizon.
Laravel 10 is scheduled for release on 10th February 2023, and here is a quick look at what changes are in store.
Laravel Pennant
This is a new first-party (ie. from the Laravel developers themselves) package which adds the idea of 'feature flags' to a Laravel 10 project, which makes it easy for you to enable / disable features without changing your code - perhaps useful for allowing certain users access to certain features, whether that be based on subscription levels, or to implement some form of split testing.
Details are sketchy at the moment, but we are looking forward to this addition to the Laravel stable, and can already foresee a number of places where it will come in exceedingly handy.
Changes to Artisan
Artisan is the incredibly useful command line tool that ships with Laravel - in Laravel 10 it will be significantly improved by the addition of more verbose interactivity. For example, at present if you ask it to create a model, but fail to specify a name, it will throw an error, but as of Laravel 10 it will not only ask you to then provide a name, but also to ask if you want to create a corresponding migration and / or factory at the same time.
This sort of improvement is part of the reason that we're such great fans of Laravel - it really shows that there is continuing thought going into how to improve all elements of the framework, not just the ones which are most used.
Use of native types rather than docblocks
This is a large change that impacts across a wide part of the framework, but one that will make developers happy as it will improve auto-completion and validation.
PHP version support requirements
Laravel 10 will see the dropping of support for PHP8.0, and the minimum required version will be PHP8.1.
PHP8.0 was originally released in late November 2020, shortly before PHP7.2 reached its end of life. Each release branch of PHP is only actively supported for two years (so active support for PHP8.0 therefore ended in November 2022), although it will continue to receive security support for one year after active support ends.
The decision to drop support for PHP8.0 in Laravel 10 is a sensible one to ensure that the latest version of Laravel also requires a supported version of PHP.
Invokable Validation rules are now the default
Whilst validation rules have been capable of being created using the InvokableRule contract for some time, this will now become the default when a new rule is created, rather than it having to be specifically passed as one of the parameter upon creation.
This is a nice little touch that then allows you to pass an instance of your validation rule to a value in the validator, easily applying the rule to the input being validated.
Features removed
As is standard, features that have been marked as deprecated in Laravel 9 may be removed in Laravel 10. Whilst a complete list will not be known until the release notes are published, a few of the pull requests indicate that, amongst other things, the Route::home, assertTimesSent and handleDeprecation methods, and the dispatchNow functionality are set to go.