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

Laravel Logging Guzzle Requests in File

In this article, we will discuss “Laravel Logging Guzzle Requests in File”. In the multiple scenarios, we have to use third-party API’s in our project and test those API using postman or any other tool. But also required to maintain a log for each request, such as what we send (request)? and what we receive (response)? Today, […] Read out the full post at here

How to Use SSH with AWS EC2 Instance?

In this article, we will discuss "How to Use SSH with AWS EC2 Instance?" . As I already explain the setup of EC2 Instance and the use of an Elastic IP in my previous article. Today, we will learn how to connect an EC2 instance using SSH. If still, you have not read my previous articles then I recommend checking them once for a better understanding. Prerequisites A running EC2 Instance . Elastic IP (Optional for this article) ".pem" file, which is downloaded when setup the EC2 Instance. If not having the ".pem" file, then you have to create new key/value pairs. Connect via Terminal or WSL(Window Subsystem for Linux) Open your terminal and go to the directory where you downloaded your ".pem" file. Use the following command to connect with the server. ssh -i "****.pem" username@<publicDNS> or <IP Address> The same terminal command can be used in the windows Linux terminal. I'm using ubuntu on my windows machine...

How to Setup and Install Next.js App?

In this article, we will discuss "How to Setup and Install Next.js App" from scratch. What is React.js and Next.js? "React.js" is a JavaScript library for building user interfaces (elements that users see and interacting on-screen). Basically, React provide us some helpful functions to build UI, and leaves it on us where to use those functions in the application. "Next.js" is a React framework. It is maintained by "Vercel" . Next.js features to solve common application requirements such as routing, data fetching, integrations - all while improving the developer and end-user experience. Why we use Next.js ? Next.js comes with the some additional features to solve come application requirements such as: We can build SSG (Static Site Generation), SSR (Server-Side Rendering) and SPA (Single Page Application) apps. Hot code Reloading: Reload the page when it detects any change saved. Routing: No need to configure any route. Files put in the pages fol...