Home Laravel 9 is now released and includes many new features Laravel Laravel 9 is now released and includes many new features Laravel 9 is now released and includes many new features

Laravel 9 is now released and includes many new features

May 31, 2022
Laravel 9 is now released and includes many new features

For many years, Laravel has been one of the most popular PHP frameworks. It’s clean, scalable, and has become the de facto framework for PHP developers and businesses. Laravel 9 is the most recent version, and it includes plenty of new features.

Current Laravel releases have been coming every six months in the past, resulting in many queries, nasty remarks, and misunderstandings regarding the new Laravel release schedule. Laravel 9 was published in February 2022, and the framework will now have a 12-month major release cycle.

New Features in Laravel 9

Minimum PHP Requirement

For testing, Laravel 9 requires the most recent versions of PHP 8 and PHPUnit 8. Because Laravel 9 will use the latest Symfony v6.0, which also requires PHP 8, this is the case.

Anonymous Stub Migration

When you perform the famous migration command, Laravel sets anonymous stub migration as the default behavior:

php artisan make:migration

New Query Builder Interface

The new query builder interface for type hinting, refactoring, and static analysis is now available in Laravel 9.

<?php

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
	});

PHP 8 String Functions

Laravel 9 targets PHP 8, hence this PR was merged, recommending the use of the latest PHP 8 string functions.

Internally in the \Illuminate\Support\Str class, these methods include str_contains(), str_starts_with(), and str_ends_with().

How to Install Laravel 9

You may install and run Laravel 9 on your local machine if you want to start toying with it for development and testing reasons.

composer create-project --prefer-dist laravel/laravel laravel-9-dev dev-develop

Was this article helpful?