What is new in Laravel 9 - Laravel Features

Last updated Feb 17, 2022

Laravel has been a widely used web framework for several years. It is a well-designed, scalable framework that is widely used by PHP developers and businesses. The most recent version of Laravel, version 9, includes a slew of new features. With each new Laravel version comes a new set of requirements and features. The Laravel team aims to address the shortcomings of the previous version by adding these new features and requirements to the next version. In Laravel 9, there are several new features that were not present in prior versions.

Laravel 9 Features, release date

 

In this article, we are going to explore the following:

  • laravel 9 release date

  • laravel 9 new features

  • Upgrading to Laravel 9

laravel 9 release date

Laravel 9's release dates have been repeatedly pushed back. As of now, many people have expressed their uncertainty and queries regarding Laravel's new release process since new Laravel versions have always been released every six months.

Laravel 9 was originally scheduled to be released in September 2021, however, the Laravel team opted to delay it until January 2022 and then February 2022. Laravel 9 release dates have frequently because of the following reasons:

  • Laravel makes use of several community-driven packages, including Symfony components. Because Symfony 6.0 had not yet been published in September 2021, the Laravel team decided to postpone the release until Symfony 6.0 was released.

  • The two-month delay gave the Laravel team time to create, test, and monitor how Laravel 9 interacts with Symfony version 6. During this time, they were able to discover any flaws and resolve any issues that may have arisen. As a result, the Laravel 9 release was well worth the wait.

Further, the Laravel team has scheduled the release of Laravel 10 on January 2023 and Laravel 11 in January 2024.

laravel 9 new features

Let's take a look at what's new and what you can anticipate in Laravel 9.

The introduction of Flysystem 2.0

Flysystem 2.0 is introduced with the release of Laravel 9, which transitioned from Flysystem 1. x to 2. x. Flystsem 2.0 was utilised in the previous version, Laravel 8.

The Symfony mailer

 For mail delivery, the Swift mailer is being replaced with the Symfony mailer. Due to the deprecation of the swift mailer, Laravel 9 has been prompted to look for a replacement.

 

PHP 8 String Functions

Given that Laravel 9 is based on PHP 8, Laravel merged this PR, implying that the new string methods in PHP 8 be implemented. Internally in the IlluminateSupportStr class, these strings include str starts with(), str contains(), and str ends with(). Laravel 9 is more functional than Laravel 8, and it will likely feature bug fixes and other game-changing improvements.

Query Builder Interface has been updated

The Query Builder Interface in Laravel 9 has been completely redesigned. Laravel 9's increased type hinting facilitates code completion, static analysis, and refactoring. The new query builder interface, as well as static analysis, refactoring, and type hinting, are now available to developers.

 

Anonymous Stub Migration

Laravel 9 has made anonymous stub migration the default migration method when you execute the Laravel migration command: php artisan make:migration. This feature was first introduced in Laravel 8.37 as a result of the Github issue.  This issue arises when numerous migrations have the same class name, and it causes problems when you try to recreate the database from scratch. The anonymous stub migration solves this issue by eliminating collisions between migration class names.

Laravel 9 migration

 

The Custom Cast and null

The set strategy of the cast course will be called with null as the specified $value parameter in Laravel 9.x. In prior Laravel versions, the custom classes set strategy was not used when the cast property was set to null. This behaviour, however, contradicted the Laravel documentation.

 

The Introduction of Default HTTP client Timeout

The HTTP client now has a default timeout of 30 seconds in Laravel 9. This implies that if the server does not respond within 30 seconds, the exception is immediately thrown. Prior versions of the HTTP client did not include a default timeout, which resulted in most requests "hanging" indefinitely. However, this does not stop you from changing your timeout request. You can always change your timeout settings in your timeout method.

 

The Lang directory location

The resources/lang directory has been moved to the root of the project in Laravel 9. Make sure your package is publishing to the app()->langPath() instead of the hard-done path if your package is publishing language files to this directory.

How to upgrade to laravel 9

To switch from the previous version (Laravel v 8) to Laravel version 9, simply follow the steps below:

Step 1: First, in the composer.json file in your project root folder, update the Laravel dependencies. To do so, simply update the following code:

laravel/framework to ^9.0

nunomaduro/collision to ^6.0

Now, just replace your façade/ignition with “"spatie/laravel-ignition": "^1.0" 

After you've made all of the changes listed above, your composer.json file should look something like this. The blue arrows indicate the locations of the modifications.

 

Laravel 9 upgrading

Image-text: composer.joson file

Step 2: Type composer update to update the Trustedproxy.php middleware in your composer command.

Step 3: Execute the “php artisan –version” command to test the integration. Laravel v. 9 will be displayed as your Laravel version

 

Conclusion

In this post, we have looked at the Laravel 9 new features and the laravel 9 release dates, and the main reason behind the Laravel 9 release delay. In this major release, the Laravel team is committed to enhancing the Laravel framework by providing better features than in prior versions. The release of Laravel 9 on February 20, 2022, marked the beginning of a one-year release cycle defined by enhanced features and requirements

Tags: laravel 9Laravel release datelaravel 9 new features

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

640 Views