logo
logo
Sign in

What are the New Features of Laravel 9?

avatar
icoderz
What are the New Features of Laravel 9?

Fly System


● Laravel 9 has migrated from fly system version 1 to fly system version 3.

● Fly system is the library that provides all file manipulation methods by the storage in laravel.

● In late 2020, the fly system was rewritten from the ground up to bring several new features and use some of the language features of php7.

● Laravel 9, we have tried to make the upgrade as seamless as possible. But, some changes may be required within your application.

● You need a version 3 of the aws f3 adapter and sftp adapter. If you use them in your application.

● If you do not want to overwrite you will need to check manually for the file’s existence before performing any of the mentioned operations. Also attempting to read from a file that doesn't exist now returns null; it used to throw an exception in laravel 8.


Read This: Laravel Performance Optimization Guide for 2022


Swift Mailer to Symphony Trailer


● In laravel 9 is the transition from swift mailer to symphony trailer.

● well swift mailer is no longer maintained as of december 2021.

● Laravel has been relying on it for all its mail sending capabilities.

● Mainly you will need to replace some of your application dependencies to be able to send mail.

● Also some of the methods have been renamed, most of these methods are low level methods.

● which used to interact with symfony mailer and previously swift mailer.


Q Flash Command


● Laravel 9 failed job database, table, stores, information about your failed queue drops. This table can become quite large and eat a lot of space we have seen that reports several times.

● So, periodically cleaning up the table is a smart move.

● Laravel already has a php arts and q flush command that will delete all the entries in the table.

● But it makes more sense to delete only the old entries not the entire table

● And for that reason laravel 9 comes with a new hours option on the q flash command.

● That option can be used to configure the number of hours to return to keep failed job data in the database.


See Also: Why Laravel is the Best PHP Framework In 2022?


Collision


● Back in April, Laravel 8.37 came with anonymous migration support.

● which solves an issue when migration classes name collision.

● The problem happens when many migrations have the same class name. Then You try to migrate the database from scratch.

● The solution was to use anonymous classes instead of named classes

● In Laravel 9 the migration stops now using anonymous classes by default.

● When you run php and make migration the class created will be an anonymous class.

● Now you can create migrations without worrying about collisions with older migrations with the same name.


Guzzle http Client


● Most new users know that laravel ships with an expressive http client that’s spelled around the guzzle http client.

● In guzzle, if the request you are trying to make doesn’t receive a response the process will completely freeze.

● If the request was made from inside a cue job the worker will freeze and won’t even respond to the timeout signal.

● To deal with issues the http client and laravel 9 will have a default timeout of 30 seconds.

● This time out will force guzzle to stop waiting for a response.

● Throw an exception that you can handle by the laravel exception handler like all others.

● Forcing a timeout like this will ensure that workers skip the job that has a stuck gaza request.

● If you want to override this default behaviour you can use the timeout method on the client before sending any request.

● In this example here the client will wait for 60 seconds before throwing at an exception.

● In all cases we don’t recommend disabling this default timeout.

● As it may cause serious issues for your applications running in production especially to your q drops.

● You may now use the controller method to define the common controller.

● For at the routes within the group using the controller method of the route facade.

● This method accepts the name of the controller class then when defining the routes inside the group.

● You only need to provide the controller method that they invoke.

● Another addition in laravel 9 is the ability to use and route binding.

● Php 8.1 added support for enumerations.

● An enumeration or an innum for short is an enumerated type that has a fixed number of possible values.


Want to Hire Laravel Developers?
collect
0
avatar
icoderz
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more