Laravel 10 New Features and Latest Updates

calendar_month 16 Apr 2023 | Laravel

In this tutorial you will learn about Laravel new version Laravel 10. Laravel is a powerful and flexible PHP web framework that has gained tremendous popularity in the world of web development. Laravel introduces features aimed at improving application security, functionality, and performance, giving developers a rich set of tools and features that make it easy to build robust and scalable web applications.

Here, I'll show you the new features and latest updates in Laravel 10, and how to install Laravel 10. Take a look at what's coming with Laravel 10:

Laravel 10 release date

According to the Laravel Support Policy, Laravel 10 was released in February 2023, but that doesn't mean you should update all your projects right away. Laravel 9 will receive bug fixes until August 23, 2023 and security fixes until February 6, 2024.

How to install Laravel 10?

Installing Laravel 10 is very easy. If you are using the official laravel installer, you can install laravel 10 using the following command which has a --dev flag, which installs the master branch from the laravel/laravel repository.

laravel new laravel-app --dev

Or, if you prefer to use Composer explicitly:

composer create-project --prefer-dist laravel/laravel laravel-app

What’s new in Laravel 10: features and latest updates

1. Laravel 10 Dropped support for PHP 8.0 and lower

There is no support for PHP version 8.0 and below in Laravel 10, it requires PHP 8.1 or PHP 8.2.

2. Eager loading optimization in Laravel 10

This new eager load optimization feature is like a plugin that handles the problem of multiple unexecutable queries. So even if there are no keys to load, Laravel still executed these queries without the proper information. This issue has been resolved in Laravel 10 as it will now check for available keys and then only execute database queries. In case there is no key, it will return an empty collection and no queries are needed.

3. dispatchNow() method has been removed in Laravel 10

The dispatchNow() method was removed because it was deprecated in Laravel 9 in favor of dispatchSync(). And now, it's been removed from Laravel 10, so be sure to find and replace it in all your projects. It may be a radical change, but it is an extremely easy fix.

Many deprecated methods and properties have been removed

Releasing a major version also means that Laravel removes features that have been deprecated in Laravel 9, so most of them have been removed.

Here’s a list of all PRs taking care of that:

[10.x] Remove deprecated Route::home method

[10.x] Remove deprecated assertTimesSent

[10.x] Remove deprecated method

[10.x] Remove deprecated dates property

[10.x] Use native php 8.1 array_is_list function

[10.x] Remove deprecations

4. Validation rules will be invokable by default in Laravel 10

Until Laravel 9, if you wanted to create a invokable validation rule, you had to add an --invokable flag with the php artisan make:rule command. But with the latest version, you won't need it anymore because Laravel 10 validation rules will be invokable by default.

php artisan make:rule Uppercase

5. Laravel 10 use Native Type Declarations in Skeleton Code

In Laravel 10, native type declarations are used instead of DocBlocks. It offers developers an improved experience.

          * Handle the User "created" event.
-         *
-         * @param  \App\Models\User  $user
-         * @return void
-        public function created($user)
+        public function created(User $user): void


Buddy! I hope you relished the tutorial, and it was good to see you again. Keep learning. Keep visiting.

Related Tutorials
View all