In modern-day website development, a database plays an essential role in managing and storing data.…
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
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.
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…