What's New in Laravel 10: A Peek at New and Upcoming Features

Written by codementor | Published 2023/03/09
Tech Story Tags: laravel | laravel-10 | php | laravel-framework | web-development | webdev | laravel-tips-and-tricks | web-apps

TLDRLaravel v10 is the next major version of Laravel, planned for release in February 2023. The process layer service will make working with, Testing, and running a [CLI] process a dream to work with. Laravel framework will drop support for `PHP <=v8.0` in Laravel 10.via the TL;DR App

Today, In this post we wanted to outline changes and features that you can expect with the Lavarel 10 update. Laravel v10 is the next major version of Laravel, after Laravel v9 and Laravel v8, planned for release in February 2023.

Laravel 10 Release Date

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 2022 (instead of the originally planned September 2021).

This schedule going forward is one major release annually:

  • Laravel 9: February 8th, 2022

  • Laravel 10: February 2023

  • Laravel 11: February 2024

Laravel 9 will continue to get bug fixes until August 8th, 2023, and security fixes until February 6th, 2024. You can expect Laravel 10 bug fixes until August 6th, 2024, and security fixes until February 4th, 2025.

Process Layer

The laravel process layer service, like the HTTP facade, makes working with APIs a cinch. The process service will make working with, Testing, and running a CLI process a dream to work with. You can check the following example from Pull request by Taylor Otwell.

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);

Which includes the features such as:

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

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.

Native type declarations in Laravel 10 skeleton

Laravel 10 will use native PHP type declarations across any generated code that can exist in userland:

https://twitter.com/taylorotwell/status/1592227118481805312?ref_src=twsrc^tfw|twcamp^tweetembed|twterm^1592227118481805312|twgr^29941c99d091f426b98c0156908eef9e8262f3e5|twcon^s1_&ref_url=https%3A%2F%2Flaravel-news.com%2Flaravel-10-type-declarations&embedable=true

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
  • Allow user land types in closure arguments
  • Does not include typed properties

Invokable Validation rules are the default

Starting in laravel 10, Invokable Validations are now 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.

Deprecations from Laravel 9

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:

  • Remove handleDeprecation method
  • Remove deprecated assertTimesSent method
  • Remove deprecated ScheduleListCommand's $defaultName property
  • Remove deprecated Route::home method
  • Remove deprecated dispatchNowfunctionality.

Testing Laravel 10

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

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

We will be updating this post as those get announced.

Thank You! Cheers...

Happy Coding!


Originally published here.


Written by codementor | A technical blog!
Published by HackerNoon on 2023/03/09