What’s New in Laravel 9

‌ Laravel has been one of the most popular PHP frameworks for many years. It’s elegant, scalable, has become one of the de facto frameworks for developers and companies working with PHP. I started with 5.3 version of laravel framework and now Laravel 9 is its latest release and comes with many new features.

In the past, new Laravel releases have been happening every six months, resulting in a fair amount of questions, harsh comments, and confusion about Laravel’s new release process. With the release of Laravel 9 in February 2022, the framework has moved to a 12-month major release cycle.

What’s New in Laravel 9?

Scheduled to be released by September 2021, Laravel 9’s release was pushed to January 2022 (and later February 2022), making it the first long-term support (LTS) release to be introduced following the 12-month release cycle. This delay results from many reasons, which include but are not limited to the following:

  1. Laravel uses varieties of community-driven projects and about nine Symfony libraries. However, Symfony is planning the release of version 6.0 by November 2021. The delay will allow the Laravel team to incorporate this new version of Symfony as part of Laravel 9.
  2. The delay will afford the team time to monitor how Laravel interacts with the new version of Symfony for two months. It also gives them room to correct any breaking changes or bugs.
  3. Lastly, delaying Laravel 9 better positions the Laravel team for yearly future releases. After Symfony’s release, it will give the team two months of additional ramp-up time.

New Features in Laravel 9

Now, let’s explore the list of the features and improvements you should expect in the upcoming major release of Laravel.

Minimum PHP Requirement

First and most importantly, Laravel 9 requires the latest PHP 8 and PHPUnit 8 for testing. That’s because Laravel 9 will be using the newest Symfony v6.0, which also requires PHP 8.

PHP 8 has significant improvements, and features, from the JIT compile to constructor property promotion. You can explore the different PHP versions benchmarks and learn how to upgrade to the latest PHP 8 

Anonymous Stub Migration

Laravel sets to make anonymous stub migration the default behavior when you run the popular migration command:

php artisan make:migration

The anonymous stub migration feature was first released in Laravel 8.37 to solve this Github issue. The issue is that multiple migrations with the same class name can cause problems when trying to recreate the database from scratch. The new stub migration feature eliminates migration class name collisions.
From Laravel 8.37, the framework now supports anonymous class migration files, and in Laravel 9, it will be the default behavior.


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)

New Query Builder Interface

With the new Laravel 9, type hinting is highly reliable for refactoring, static analysis, and code completion in their IDEs. Due to the lack of shared interface or inheritance between Query\Builder, Eloquent\Builder, and Eloquent\Relation. Still, with Laravel 9, developers can now enjoy the new query builder interface for type hinting, refactoring, and static analysis.


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 version added the new Illuminate\Contracts\Database\QueryBuilder interface, as well as the Illuminate\Database\Eloquent\Concerns\DecoratesQueryBuilder trait that will implement the interface in place of the __call magic method.

PHP 8 String Functions

Since Laravel 9 targets PHP 8, Laravel merged this PR, suggesting using the newest PHP 8 string functions.

These functions include the use of str_contains()str_starts_with(), and str_ends_with() internally in the \Illuminate\Support\Str class.

Laravel 9’s features and improvements listed above are a sneak peek at what is to come. It’ll most definitely bring lots of bug fixes, features, and, of course, many breaking changes.