Skip to main content

Features of Laravel 9

The new version of Laravel 9 is released on 8 February 2022, it's an LTS version of Laravel. In this article, we will discuss the features of Laravel 9. No introduction is required for Laravel, it's a mostly used PHP framework for a long time now.

Laravel Support Policy


Laravel 9 provides long-term support, similar to Laravel 6. It's an LTS version so Laravel 9 will provide the longest maintenance and support guidance. You will get two years of support to fix bugs, which will remain until February 2024. For Security support, it will be for three years which will last till 2025. Please check the following.



Read more on support policy here.

Minimum requirement of PHP 8.


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 9. This is the reason for the minimum requirement of PHP 8.

Anonymous Stub Migrations


In the latest version of Laravel, anonymous stub migration is a default behavior when you execute the popular migration command:
php artisan make:migration add_users_nick_name --table=users

The stub migration feature eliminates migration class name collisions. For example, the migration class looks like the following:
<?php

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('users', function (Blueprint $table)
$table->string('nick_name')->nullable();
);


/**
* Reverse the migrations.
*
* @return void
*/
public function down()

Schema::table('users', function (Blueprint $table)
$table->dropColumn('nick_name');
);

;

New Query Builder Interface


Laravel 9 provides New Query Builder Interface, making it easier for developers to work 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 a shared interface or inheritance between QueryBuilder, EloquentBuilder, and EloquentRelation. Developers can take advantage of the new query builder interface type hinting, refactoring, and static analysis with Laravel 9.

PHP 8 string functions


PHP string function is one of the key features of Laravel 9 to look after because this new version is more focused on using PHP 8.0 and its string function that includes str_contains(), str_starts_with(), and str_ends_with().

Swift Mailer to Symphony Mailer


Swift Mailer is replaced with the Symfony Mailer, which provides more consistency to your application. Symfony deprecated the Swift Mailer and introduced the Symfony Mailer. Because Laravel mostly depends on the Symfony component so Laravel 9 is shifted to Symfony mailer.

Default HTTP Client Timeout


HTTP clients default timeout in 30sec. This step will help avoid hangs occurring in the Laravel previous versions.

In other words, in case the server does not respond within 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(...);

New Design


Route List


Laravel 9 provides a new design for the route list. So when we use the following command:
php artisan route:list

After that terminal looks like.


Exception


Exception page theme has been improved. With this exponential feature, you can customize or choose available themes at your convenience.


Conclusion


In this article, we are discussing some features of Laravel 9. Hope this will gave you some exposure to Laravel 9. Please feel free to add comments if any queries or send your feedback.

Keep learning & stay safe ;)

Comments

Popular posts from this blog

Basic Use of Model Factories in Laravel

In this article, we will discuss the basic use of Model Factories in Laravel. Laravel comes with the feature called model factories that are offered to made fake models quickly. It’s used in the database testing and database seeding. Let’s start the discussion on this feature by... Read out the full post at here

How to Manage Elastic IP in AWS?

In this article, we will discuss "How to Manage Elastic IP in AWS?" . Here, you will learn the use of Elastic IP addresses and how to assign it to your EC2 Instance. If you are new with EC2 Instance then check out my previous article, "How to setup an EC2 Instance on AWS" . EC2 (Amazon Elastic Compute Cloud) provide us an ability to create, start, stop and terminate the instance at any time. This will creates a challenge with IP addresses, because restarting an instance or replacing a terminated instance with newly created instance, will result in a new IP address. Now the question is "How to reference a machine when the IP is constantly change?" . We can handle this situation with the use of Elastic IP address. We can associate a single Elastic IP address to different Ec2 Instances. You can immediately associate a new Ec2 Instance with the Elastic IP address if the EC2 instance is stopped or terminated. After the back-end EC2 instance changes, our exist...

How to use trackBy in Angular with Example

In this article, we will discuss "How to use trackBy in Angular" . Basically, " trackBy " is used to improve the performance of an angular application. Today, I will try to explain the use of trackBy with an example. Why do we need trackBy in Angular? By default, no need to use trackBy in Angular. But with large collections of data, angular ngFor directive may perform poorly. For example, a small change of data such as adding a new record, editing, or deleting a record from the collection. The angular framework will remove all the DOM elements that are associated with the data and will create them again in the DOM tree even if the same data is coming. Here, a lot of DOM manipulation will happen in the background if a large amount of data comes from the API then the application performance will suffer. Angular trackBy example Angular provides us function trackBy which helps us to track the items which have been added or deleted. The trackBy function takes two argum...