Laravel 10 is now released!

Published on by

Laravel 10 is now released! image

Laravel 10 is now released, including a minimum PHP v8.1 version, a new Laravel Pennant package, invokable validation rules, native type declarations, and more...

Laravel Release Schedule

Before Laravel 9, major framework versions were released twice a year or roughly every six months. Starting with Laravel 9, the core team went to an annual schedule, shipping Laravel 9 in February of 2022 (instead of the originally planned September 2021):

Laravel uses a variety of community-driven packages as well as nine Symfony components for a number of features within the framework. Symfony 6.0 is due for release in November. For that reason, we are choosing to delay the Laravel 9.0 release until 2022.

By delaying the release, we can upgrade our underlying Symfony components to Symfony 6.0 without being forced to wait until September 2022 to perform this upgrade. In addition, this better positions us for future releases as our yearly releases will always take place two months after Symfony's releases.

This schedule going forward is one major release annually:

  • Laravel 9: February 8th, 2022
  • Laravel 10: February 14th, 2023
  • Laravel 11: Q1 2024

Laravel 9 will continue to get bug fixes until August 8th, 2023 and security fixes until February 14th, 2024.

You can expect Laravel 10 bug fixes until August 6th, 2024 and security fixes until February 14th, 2025.

Let's look at some of the big new features in Laravel 10:

Laravel 10 drops support for PHP 8.0

Laravel framework will drop support for PHP <=v8.0 in Laravel 10. The minimum required version is PHP ^8.1. Browsing the comparison between master and 9.x, we can expect to see 8.1 features used in the framework, such as readonly properties.

Laravel Pennant

Laravel Pennant is a package created by the Laravel team that will arrive with Laravel 10 and provides Feature Flags for your applications.

Feature flags enable you to incrementally roll out new application features with confidence, A/B test new interface designs, compliment a trunk-based development strategy, and much more.

This package is the latest in the lineup of official packages provided by the core team and means that we now have a well-built and well-tested package that provides us with some great functionality.

Process layer for Laravel

The Laravel Process service makes testing and running CLI processes a dream to work with.

use Illuminate\Support\Facades\Process;
 
$result = Process::run('ls -la');
 
$result->successful();
$result->failed();
$result->exitCode();
$result->output();
$result->errorOutput();
$result->throw();
$result->throwIf($condition);

The Process layer includes rich features out of the box, such as:

  • Fluent process methods to build a process instance before running it
  • Process output handling as it is received
  • Asynchronous processes
  • Process Pools
  • Rich testing features via fake()
  • Preventing stray processes during tests

Testing processes has never been easier.

Native type declarations in Laravel 10 skeleton

In Laravel 10, the Application Skeleton Code Will Have Native Type Declarations. This means that any code in userland generated by the framework will have type-hints and return types. Our article discusses the caveats around the approach, and we think you will love the added types when creating new projects in the future.

Types are being added in a way that brings the latest PHP type-hinting features to Laravel projects without breaking backward compatibility at the framework level:

  • Return types
  • Method arguments
  • Redundant annotations are removed where possible
  • Allow user land types in closure arguments
  • Does not include typed properties

Invokable Validation rules are the default

Starting in Laravel 10, invokable validation rules are now the default. When you create a new validation rule via artisan, this is what you can expect:

# Laravel 9 creates a rule class that implements the
# Illuminate\Contracts\Validation\Rule interface
artisan make:rule Uppercase
 
# Laravel 9 flag to create an invokable and implicit rule
artisan make:rule Uppercase --invokable
artisan make:rule Uppercase --invokable --implicit
 
# Laravel 10 creates an invokable rule by default
artisan make:rule Uppercase
 
# Laravel 10 implicit rule
artisan make:rule Uppercase --implicit

Profile option for tests

A new feature coming to Laravel 10 is a --profile option that will make it easy for you to find any slow tests in your application.

This --profile option should help keep your tests fast and help you either fix the slow tests or to better group them to make it easier not to run them all the time.

New String Password helper

The Str::password method can generate a secure, random password of a given length. The password will consist of a combination of letters, numbers, symbols, and spaces. By default, passwords are 32 characters long:

use Illuminate\Support\Str;
 
$password = Str::password();
 
// 'EbJo2vE-AS:U,$%_gkrV4n,q~1xy/-_4'
 
$password = Str::password(12);
 
// 'qwuar>#V|i]N'

Deprecations from Laravel 9

Methods marked as deprecated in Laravel 9 are being removed in Laravel 10. We can expect the release upgrade guide to outline all the deprecated methods, potential impact assessment, and how to upgrade closer to the release.

Here are some deprecations found in the comparison of the Laravel framework's master branch to the 9.x branch at the time of writing:

Testing Laravel 10

If you want to start testing Laravel 10 now, you can install it in a new project by using the --dev flag:

laravel new <your-project-name> --dev

Upgrading to Laravel 10

The easiest way to upgrade is to utilize Laravel Shift and it can automate always keeping your application up to date, or follow the upgrade guide.

And More...

You can also check out the official releases page to look for updated information as it becomes available.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes.

Visit Larafast: Laravel SaaS Starter Kit
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
All Green logo

All Green

All Green is a SaaS test runner that can execute your whole Laravel test suite in mere seconds so that you don't get blocked – you get feedback almost instantly and you can deploy to production very quickly.

All Green
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Property Hooks Get Closer to Becoming a Reality in PHP 8.4 image

Property Hooks Get Closer to Becoming a Reality in PHP 8.4

Read article
Asserting Exceptions in Laravel Tests image

Asserting Exceptions in Laravel Tests

Read article
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article
Basset is an alternative way to load CSS & JS assets image

Basset is an alternative way to load CSS & JS assets

Read article
Integrate Laravel with Stripe Connect Using This Package image

Integrate Laravel with Stripe Connect Using This Package

Read article
The Random package generates cryptographically secure random values image

The Random package generates cryptographically secure random values

Read article