Laravel 10: release date and new features

Benjamin Crozat Benjamin Crozat8 minutes read

Table of contents

Laravel 10: release date and new features

When will Laravel 10 be released?

According to the Support Policy, Laravel 10 is scheduled to be released in February 7, 2023.

The release of Laravel 10 doesn’t mean you have to update all your projects immediately, though.

The framework last had LTS (Long-Term Support) in version 6, but each major version now has two years of updates, which should give you enough time to get your codebase in check and upgrade it.

Laravel 9 will receive bug fixes until August 23, 2023 and security fixes until February 6, 2024.

Version PHP Release Bug fixes until Security fixes until
 9 8.0 - 8.1 February 8, 2022 August 8, 2023 February 6, 2024
 10 8.1 February 7, 2023 August 6, 2024 February 4, 2025

How to install Laravel 10?

Installing Laravel 10 is easy. The Laravel installer has a --dev flag, which installs the master branch from the laravel/laravel repository.

laravel new hello-world --dev

Or, if you prefer to explicitly use Composer:

composer create-project --prefer-dist laravel/laravel laravel-dev dev-master

New features and changes in Laravel 10

Laravel Pennant: feature flags with ease

Laravel Pennant is a first-party package that adds feature flags to any Laravel 10 project.

Features flags are a way to enable or disable features at runtime without changing your code.

For instance, you may want to deploy a feature only for a select set of users in your production environment. This is great for A/B testing.

The package isn’t available yet.

Artisan becomes more interactive

Artisan becomes more interactive

Starting from Laravel 10, Artisan will be more interactive. Say you ask it to create a model but forgot to pass the name:

php artisan make:model

Instead of throwing an error, it will just ask you the name of the model, but also if you want to create a migration, a factory, etc. Extremely handy!

php artisan make:model
 
What should the model be named?
Post
 
Would you like any of the following? [none]
none ......................................................................................... 0
all .......................................................................................... 1
factory ...................................................................................... 2
form requests ................................................................................ 3
migration .................................................................................... 4
policy ....................................................................................... 5
resource controller .......................................................................... 6
seed ......................................................................................... 7

Laravel 10 uses invokable validation rules by default

In Laravel 9, invokable validation rules could be generated using the --invokable flag with the php artisan make:rule command. Starting from Laravel 10, you won’t need it anymore.

php artisan make:rule Uppercase

To remind you a bit of what invokable validation rules are, here’s what they look like:

namespace AppRules;
 
use IlluminateContractsValidationInvokableRule;
 
class Uppercase implements InvokableRule
{
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param Closure(string): IlluminateTranslationPotentiallyTranslatedString $fail
* @return void
*/
public function __invoke($attribute, $value, $fail)
{
if (strtoupper($value) !== $value) {
$fail('The :attribute must be uppercase.');
}
}
}

The boilerplate code is considerably smaller and easier to understand. Thanks to Laravel 10, people will be less intimidated by the perspective of making custom validation rules.

See the pull request on GitHub: [10.x] Make invokable rules default

The Laravel 10 skeleton uses native types instead of docblocks

Starting with Laravel 10, the skeleton will now use native types instead of docblocks. This PR is massive and is still a work in progress, because it will happen in the whole Laravel organization.

For instance, in the Laravel skeleton, the schedule() method in app/Console/Kernel.php will look like this:

/**
* Define the application's command schedule.
-
- * @param IlluminateConsoleSchedulingSchedule $schedule
- * @return void
*/
- protected function schedule($schedule)
+ protected function schedule(Schedule $schedule): void

The team will also add generic type annotations, which will drastically improve autocompletion as well when coding (given your code editor supports generics).

See the pull request on GitHub: [10.x] Uses PHP Native Type Declarations 🐘

Official packages will also use native types

Actually, you won’t have to wait until Laravel 10 to enjoy native type hints in official Laravel packages. It’s rolling out right now.

You can check out this PR, that initiates the switch from dockblocks to native type hints in Laravel Jetstream.

Dropped support for PHP 8.0

Laravel 10 dropping support for PHP 8.0 and requiring 8.1 as a minimum means two things if you want to upgrade:

But remember: your Laravel apps don’t need to be updated to the latest and greatest as soon as they’re released.

Especially if you have projects with paid clients or employees who depend on them to do their work.

They need to slowly but surely move forward by doing extensive testing. Don’t rush.

See the pull request on GitHub: [10.x] Drop PHP 8.0

PHP 8.1

Dropped support for Predis v1

If you’re forcing the usage of Predis v1 in your project, you might want to upgrade to v2.

To see what changed in Predis v2, take a look at the changelog.

See the pull request on GitHub: [10.x] Drop Predis v1 support

In my opinion, instead of using Predis, you should consider using PHP’s native Redis extension, which is faster and could speed up your website if you have a lot of traffic.

dispatchNow() has been removed

dispatchNow() is a popular method in Laravel. It was deprecated in Laravel 9 in favor of dispatchSync(). Laravel 10 will remove it, so be sure to search and replace it in all of your projects. It may be a breaking change, but it’s an extremely easy fix.

See the pull request on GitHub: [10.x] Remove deprecated dispatchNow functionality

Many deprecated methods and properties have been removed

Releasing a major version also means the Laravel team can finally remove features that have been deprecated in Laravel 9. It also means you should carefully test any Laravel application you might want to migrate to version 10.

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

doctrine/dbal is not needed anymore to modify columns in migrations

Column modifications happen in your migrations like so:

 
return new class extends Migration
{
public function up()
{
Schema::table('foo', function (Blueprint $table) {
$table->unsignedBigInteger('bar')->change();
});
}
 
}

In Laravel 9, you had to install doctrine/dbal to do the job. But now, migrations support the native operations provided by most of the databases Laravel supports.

Suppose you have multiple database connections and already installed Doctrine DBAL. In that case, you should call Schema::useNativeSchemaOperationsIfPossible() to use native operations before falling back on the package (for instance, SQLite doesn’t support this yet).

use Illuminate\Support\Facades\Schema;
 
 
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Schema::useNativeSchemaOperationsIfPossible();
}
}

Learn more:

How to contribute to Laravel 10?

Did you know you could create the next big feature for Laravel 10?

  1. See what’s going on for Laravel 10 on GitHub: https://github.com/laravel/framework/pulls. The Pull Requests will tell you what’s already been done.
  2. Take one of your pain points with the framework and create a solution yourself.
  3. Send the PR over to the laravel/framework repository, collect feedback, improve and get merged.

One important tip to increase your chances of being merged: add something to the framework that’s a win for developers, but not a pain to maintain for Taylor and his team in the long run.

Pull requests on the laravel/framework repository.

Laravel 10 Bug Hunt: win $1K for fixing bugs

Laravel 10 Bug Hunt

Taylor Otwell announced the Laravel 10 bug hunt.

Fix bugs, and be one of the random winner to get $1K richer!

This contest will end as soon as Laravel 10 is released.

Here are the rules:

More details on the official Laravel blog: Laravel 10 Bug Hunt


This is what’s new in Laravel 10 for now.

There’s more to come until February 2023, though.

Don’t miss any update on this post. Subscribe to my newsletter and follow me on Twitter!

Recommended

Laravel 11 will be released on February 6th, 2024. Its development is still ongoing. Let's dive into every relevant new feature we know about already.

Learning a framework can be overwhelming, but time and execution will make you a master. Here are some best practices to help you toward your goal.

Nailing a Laravel job interview can be a daunting task, but with the right preparation and mindset, you can set yourself up for success.

Have you heard about Laravel but don't know where to start? Don't worry; you just found the best starting point for your journey.

Here's a case study for my blog in the programming niche, where I share everything I did to increase clicks by a huge amount since the beginning.

Browse my list of the best hosting providers for your next Laravel app. All budgets and needs are covered.

Choose a web hosting provider for Laravel Forge and deploy your next Laravel project quickly and without any DevOps cost.

Start leveraging the power of AI, today. AI enables developers to do incredible things, and many startups build products around it.

Migrations are essential in any Laravel app using a database. I will tell you what they are, why you should use them and how you can generate them.

Learn why and how to fix "Methods with the same name as their class will not be constructors in a future version of PHP" warnings.

Powered by