Laravel v9 is the next LTS (stable) version of Laravel to be released by early 2022. In this post, I want to mention all the new features and changes that have been announced so far.
Laravel Release Date Changes 9
Laravel 9 was supposed to be released around September (August) this year, but Laravel's team decided to release this version in January 2022:
Laravel uses a variety of community-based packages as well as nine Symfony components for some of its features. Symphony version 6 is scheduled to be released in November this year. For this reason, the Laravel team decided to postpone the release of Laravel version 9 until January 2022 (January 1400).
With this delay, the main components of the Laravel symphony can be upgraded to version 6 symphony. Otherwise, this upgrade will last until September 2022. In addition, it will be better for the release of later versions of Laravel. Because Laravel's annual publication is always done two months after the release of Symphony.
This change will affect the original versions as well, and it will delay them. The future plan is as follows:
Laravel 9: January 2022 (January 1400)
Laravel 10: January 2023 (January 1401)
Laravel 11: January 2024 (January 1402)
PHP 8 is the minimum version in Laravel 9
Since Laravel 9 requires Symphony 6 and Symphony 6 requires at least PHP version 8, the new version of Laravel will meet this requirement. So Laravel 9 requires PHP version 8 and above.
Stub Anonymous Migrations
Earlier this year, Laravel 8.37 was introduced with a new feature called Anonymous Migrations. This feature prevents migrating class names from colliding.
use Illuminate \ Database \ Migrations \ Migration;
use Illuminate \ Database \ Schema \ Blueprint;
use Illuminate \ Support \ Facades \ Schema;
return new class extends Migration {
/ **
* Run the migrations.
*
* @return void
* /
public function up ()
{
Schema :: table ('people', function (Blueprint $ table) {
$ table-> string ('first_name') -> nullable ();
});
}
};
When Laravel 9 launches, this mode runs by default when running the php artisan make: migration command.
New query builder interface
Thanks to Chris Morel, the next version of Laravel has a new Query Builder interface. To see more details about this event, you can see the request for this change in GateHub.
For developers who are confident in their editor for static parsing, refactoring, or completing code, the lack of a common interface or inheritance between Query \ Builder, Eloquent \ Builder, and Eloquent \ Relation can be very difficult:
return Model :: query ()
-> whereNotExists (function ($ query) {
// $ query is a Query \ Builder
})
-> whereHas ('relation', function ($ query) {
// $ query is an Eloquent \ Builder
})
-> with ('relation', function ($ query) {
// $ query is an Eloquent \ Relation
});
This feature adds a new Illuminate \ Contracts \ Database \ QueryBuilder interface and an Illuminate \ Database \ Eloquent \ Concerns \ DecoratesQueryBuilder trait. Which implements the interface instead of running __call.
PHP string functions 8
Since PHP version 8 will be the minimum version of PHP, Tom Shot added:
str_contains, str_starts_with, and str_ends_with
functions to the Illuminate \ Support \ Str class upon request.