Blog Detail

20

Jul
A Glance at  Laravel 9 Modern Features and Updates cover image

arrow_back A Glance at Laravel 9 Modern Features and Updates

Laravel v9 will be another LTS form of Laravel, and it’ll be coming out at some point in early 2022. In this post, we wanted to describe all the modern highlights and changes announced so far.

Laravel 9 Release Date Changes

Laravel v9 was planned to be released around September of this year, but the Laravel Crew chosen to thrust this release back to January of 2022.

Laravel utilizes an assortment of community-driven packages as well as nine Symfony components for several highlights inside the framework. Symfony 6.0 is due for release in November. For that reason, we are deciding to hold the Laravel 9.0 release until January 2022. By postponing the release, we will update our basic Symfony components to Symfony 6.0 without being constrained to hold up until September 2022 to perform this update.

It means that the future Laravel release schedule will seem as follows:

  1. Laravel 9.0: January 2022
  2. Laravel 10.0: January 2023
  3. Laravel 11.0: January 2024

PHP 8 is the minimum version in Laravel 9

Since Laravel 9 will need Symfony 6.0 and it incorporates a least prerequisite of PHP 8 which means Laravel 9 will carry this same confinement.

Anonymous Stub Migrations

At the beginning of this year, Laravel 8.37 came out with a new feature called Anonymous Migrations that restricts migration class name collisions.

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 releases, this will be the default when you run php artisan make:migration

New Query Builder Interface

Appreciations to Chris Morrell, Laravel 9 will highlight a new Query Builder Interface, and you can view this merged PR for all the details.

For developers who depend on sort insights for static analysis, refactoring, or code completion in their IDE, the need for a shared interface or legacy between Query\Builder, Eloquent\Builder, and Eloquent\Relation can be much complex.

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 highlight adds a new Illuminate\Contracts\Database\QueryBuilder interface and an Illuminate\Database\Eloquent\Concerns\DecoratesQueryBuilder trait that implements the interface in point of the existing __call implementation.

PHP 8 String Functions

Since PHP 8 will be the least, Tom Schlick acknowledged a PR to move to using str_contains(), str_starts_with() and str_ends_with() functions internally in the \Illuminate\Support\Str class.

Published at : 20-07-2021

Author : Rizwan Aslam
AUTHOR
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project