This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Laravel 9 Features & What’s About To Come!

Updated on March 30, 2022

6 Min Read
laravel 9

Laravel has been one of the most prevalent PHP frameworks for a long time now. It is adaptable, scalable, versatile, and has become one of the in fact the systems for engineers and companies working with PHP. Now, Laravel 9 is on it’s way, with a number of new features. There’s no surprise that Laravel has become one of the leading PHP frameworks for building endeavor review web applications, custom and robust applications.

Laravel always aims to make the advancement process smoother and faster; So, they are continuously seeking out new releases with new functionalities, features, advancements, and much more. Laravel has gone through several updates. Its features and functionalities have developed so well that it has ended up being the go-to PHP system for web application development.

Initially scheduled to be released by September 2021, Laravel 9 was pushed to January 2022, making it the first long-term bolster (LTS) release to be introduced following the 12-month release cycle. Let’s discuss all the new Laravel 9 features and updates that have been announced so far.

Laravel 9 & What To Expect

Laravel 9 is said to be the first Long Term Support released in a 12-month release cycle and this was initially announced to be released by September 2021. However, it was later decided to push it to January 2022. Laravel has system dependencies in different community-driven and Symfony 9 libraries, and Symfony had planned to release Symfony v6.0 by November 2021, which led the Laravel team to delay release of Laravel v9. To upgrade or update the complete Laravel framework to the most recent version of Symfony, it will take a while and also lots of testing and monitoring against any breaking changes before releasing it to the market. At last, deferring the release of Laravel 9 till January 2022, will better position the Laravel team to release the ensuing LTS annually. Giving the Laravel team 2 months after Symfony’s releases.. Now that you know the reasons for the changes, let’s explore the new Laravel v9 before it is released on 22nd January, 2022.

Laravel 9 New Features

Minimum PHP Requirement

Laravel 9 requires the most up to date form of PHP 8, PHPUnit 9, and a number of other prerequisites specified within the future. Laravel, as a framework, depends on several community-driven and Symfony 9 libraries. As Symfony planned to release v6.0 by November 2021, that forced the Laravel team to delay the release of Laravel v9. The PHP 8 requirement is because Laravel 9 is solely dependent on Symfony’s latest v6.0 release, which depends on PHP 8. You can explore what is new in PHP 8 and the distinctive PHP versions benchmarks to grasp the advancements and features of PHP 8 from Just-In-Time compiler (JIT) to constructor property promotion.

Anonymous Stub Migration

Laravel sets to introduce anonymous stub migration as a default behavior when you execute the popular migration command:

php artisan make:migration

The anonymous stub migration feature was first introduced in Laravel 8.37 to solve the Github issue. The issue comes up with multiple migrations in the same class name can cause issues when attempting to recreate the entire database. The stub migration feature eliminates migration class name collisions.

New Query Builder Interface

With Laravel 9, type hinting is exceedingly reliable for refactoring, inactive analysis, and code completion in their IDEs. That’s due to the need for ashared interface or inheritance between QueryBuilder, EloquentBuilder, and EloquentRelation. Still, with Laravel 9, engineers can now enjoy the new query builder interface for type hinting, refactoring, and static analysis.

PHP 8 String Functions

Since Laravel 9 targets PHP 8, Laravel combined this PR, suggesting utilizing the most up to date PHP 8 string functions. These functions incorporate the use of str_contains(), str_starts_with(), and str_ends_with() internally in the IlluminateSupportStr class. Laravel 9’s features and improvements listed are a sneak peek of what’s to come. It’ll most definitely bring parts of bug fixes, features, and of course, numerous breakthrough changes.

Nothing as Easy as Deploying Laravel Apps on Cloud

With Cloudways, you can have your PHP apps up and running on managed cloud servers in just a few minutes.

Why move from Laravel 8 to 9

Flysystem 2.0

Laravel 9.x has migrated from Flysystem 1.x to 2.x. Under the hood, Flysystem powers all of the record manipulation strategies given by the Capacity facade. In light of this, a few changes may be required inside your application. In any case, we have attempted to create this move as consistent as conceivable.

Symfony Mailer

One of the biggest changes in Laravel 9.x is the move from SwiftMailer, which is no longer kept up as of December 2021, to Symfony Mailer. However, Laravel attempted to create this move as consistent as conceivable for your applications. That being said, it would be ideal if you completely review the list of changes below to ensure your application is completely consistent.

Custom Casts & null

In past releases of Laravel, the set strategy of custom cast classes was not invoked in case the cast attribute was being set to null. However, this behavior was in conflict with the Laravel documentation. In Laravel 9.x, the set strategy of the cast course will be invoked with null as the given $value argument. Hence, you ought to guarantee your custom casts are able to adequately handle this situation.

Default HTTP Client Timeout

The HTTP client now includes a default timeout of 30 seconds. In other words, in case the server does not respond inside 30 seconds, an exception will be tossed. Already, no default timeout length was arranged on the HTTP client, causing requests to sometimes “hang” indefinitely. If you wish to specify a longer timeout for a given request, you may do so using the timeout method:

$response = Http::timeout(120)->get(...);

The lang Directory

In Laravel 9.x applications, the resources/lang directory as of now is located within the root project directory (lang). If your package is publishing language files to this directory, you have to make sure that your package is publishing to app()->langPath() rather than a hard-coded path

The Password Rule

The password rule, which validates that the given input esteem matches the confirmed user’s current password, has been renamed to current_password. The when / unless Methods As you may know, when and unless methods are offered by various classes throughout the framework. These methods can be used to conditionally perform an action if the boolean value of the first argument to the method evaluates to true or false:

$collection->when(true, function ($collection) {
    $collection->merge([1, 2, 3]);
});

Hence, in past releases of Laravel, passing a closure to the when or unless methods implied that the conditional operation would always execute, since a loose comparison against a closure object always evaluates to true. This often leads to startling results since engineers anticipate the result of the closure to be utilized as the boolean value that decides if the conditional action executes. So, in Laravel 9.x, any closures passed to the when or unless methods will be executed and the value returned by the closure will be considered the boolean value utilized by the when and unless methods.

Influencers on Laravel 9

We reached out to a few member of the community and followed influencers from twitter regarding the reviews on Laravel 9, here is what they have to say about it,

Graham Cambell

“Laravel 9 is mostly a release to enable us to make some breaking changes and upgrade to Symfony 6 components, move from Swift Mailer to Symfony Mailer, and upgrade to Flysystem 2. Almost every new feature has been landing in Laravel 8, with new features landing almost every week for the last year. Dries and I and many others worked hard to ensure Laravel 8 and its supporting packages worked on PHP 8.1, so there’s no need to wait until Laravel 9 to upgrade to PHP 8.1, which is super cool.”

Taylor Otwell

“I’m finding the Laravel 9 release is much more of a minor “maintenance” release compared to other previous major Laravel releases. Committing ourselves to only 1 “major” release a year really pushed us to ship a bunch of stuff we would have typically held back for a major.”

Jess Archer

“Laravel 9 doesn’t have as many headline features as a normal Laravel release because the team have been focusing on releasing new features throughout the year now that they’ve moved to a yearly release cycle. There’s a pretty comprehensive list of the new features at https://laravel-news.com/laravel-9. The one thing that isn’t mentioned there that I’m excited about is the new support for generics on the Collection class which will really help improve static analysis.”

Conclusion

Laravel is a compelling PHP framework that’s picking up more consideration among developers. Its up and coming major release is the primary one taking after a 12-month release cycle, and able to already see it’ll introduce “juicy” new features. Laravel will likely add new features before the release date, so do follow this article for future updates and reviews.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Cloudways hosting has one of the best customer service and hosting speed”

Sanjit C [Website Developer]

Inshal Ali

Inshal is a Content Marketer at Cloudways. With background in computer science, skill of content and a whole lot of creativity, he helps business reach the sky and go beyond through content that speaks the language of their customers. Apart from work, you will see him mostly in some online games or on a football field.

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!