What’s new in Laravel 10? Lets Explore features and advantages

What’s new in Laravel 10? Lets Explore features and advantages

To ensure the users have access to the latest and greatest features, the framework’s core……

  • March 17, 2023
  • 6 minutes read


Software Programmer

To ensure the users have access to the latest and greatest features, the framework’s core team consistently strives to improve it. Therefore, it is advisable to utilize version constraints such as ‘^10.0’ while referencing the framework or its elements in an application or package. This is because newer versions may bring significant modifications and enhancements. The present version of Laravel, which is version 10, incorporates various substantial upgrades that can be advantageous for product owners. It’s time to discover What’s new in Laravel 10?  Let’s delve deeper into What’s new in laravel 10 alterations and Explore features and advantages of Laravel 10.

Why Laravel 10 is important?

We will discuss What’s new in Laravel 10? with their updated features, advantages and disadvantages.

Laravel 10 has been released, featuring several impressive features, including:

  1. PHP 8.0 support has been dropped from Laravel 10
  2. Introduced Laravel Pennant Package
  3. Working with testing and running CLI processes becomes a delightful experience with the Laravel Process layer.
  4. The Laravel 10 skeleton includes declarations for native types.
  5. There is a default set of invokeable Validation rules
  6. A profile option for tests is available
  7. A new tool for helping to create string passwords
  8. Understanding the Removal of Deprecated Methods

What’s new in Laravel 10?


PHP 8.0 support has been dropped from Laravel 10

Starting from Laravel 10, the Laravel framework will no longer provide support for PHP versions lower than v8.0, and will require at least PHP ^8.1. By examining the differences between the master and 9.x branches, it appears that the framework will incorporate features from PHP 8.1, including readonly properties.

Introduced Laravel Pennant Package

The Laravel team has developed a package called “Laravel Pennant” that will come bundled with Laravel 10 and allows for implementing Feature Flags in your applications.

With feature flags, you can introduce new features to your application gradually and with assurance, conduct A/B testing on new interface designs, supplement a trunk-based development approach, and accomplish many other objectives.

The core team has recently released their newest official package, which adds significant value to our toolkit. This well-crafted and thoroughly tested package offers excellent functionality.

Let’s examine the package’s features to understand its capabilities better.

Let’s Create new feature in our laravel application:
in your AppServiceProvider located in app/Providers/AppServiceProvider

/**Determine whether the user can create models.*/
public function boot(): void
      Feature::define('beta-testers', fn (User $user) => match (true) {
        $user->isBetaTester() => true,
        default => false,

You can also use class based approach to create new service,

class BetaTesters{
  public function resolve(User $user): mixed{
     return match (true) {
        $user->isBetaTester() => true,
        default => false,

Looking ahead, this approach is effective for an API with versions – it enables you to direct the request to its intended destination according to the user’s privileges. Let’s elaborate on this illustration.

class PodcastController{
   public function __construct(
     private readonly RedirectAction $action,) {}
   public function index(Request $request): Response{
     return Feature::when(BetaTester::class,fn () => $this->action->handle('v2'),
        fn () => $this->action->handle('v1'),

Depending on whether or not the user is a beta tester, one option is to use our action for pointing to the proper API route. By moving this procedure up to middleware at a higher layer, we could make it more efficient.

class VersionMiddleware{
  public function handle(Request $request, Closure $next): mixed{
    if (Feature::active('beta-tester')) {
      return new RedirectResponse(uri: 'generate the url here',);
    return $next($request);

For more detailed explanation you must visit Laravel Pennant Package.

Laravel Process layer makes testing and running CLI processes easier:

Testing and running CLI processes is a breeze thanks to Laravel 10’s new Process Interactions. It provides a simple API to lessen the burden of testing. Let’s take an illustration from the initial PR for Taylor’s article:

use Illuminate\Support\Facades\Process; 
    $result = Process::run('ls -la');

Several features are built into the Process layer right out of the gate, including:

  • Building a process instance using fluid process methods before running it
  • handling of process output as it is received
  • Synchronous procedures
  • Pools of Process
  • Extensive testing capabilities using fake ()
  • avoiding errant processes while running tests
  • Process testing has never been simpler.

The Laravel 10 skeleton includes declarations for native types

The upcoming release of Laravel 10 will feature native type declarations in the application skeleton code. This means that any user-generated code within the framework will include type-hints and return types. In our essay, we discuss the limitations of this approach, but we believe you’ll find the new features useful for your future projects.

The implementation of types in Laravel 10 has been designed to maintain backward compatibility with the framework while incorporating the latest PHP type-hinting functionality. This includes return formats, approach arguments, and the removal of redundant annotations wherever possible. In addition, users will be able to define their own types in closure arguments, although typed properties will not be included.

There is a default set of invokable Validation rules

Invokable validation rules are now the standard as of Laravel version 10. What to anticipate while creating a new validation rule using Artisan:

    # 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

A profile option for tests is available

The —profile option, a new feature of Laravel 10, will make it simple for you to locate any delayed tests in your application.

This —profile option should help keep your tests quick and assist you in either fixing the sluggish tests or better organising them so you can run them less frequently.

A new tool for helping to create string passwords

A random, safe password of a specified length can be created using the Str::password method. There will be a mix of characters, numbers, symbols, and spaces in the password. Passwords are 32 characters long by default.

    use Illuminate\Support\Str;

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

Understanding the Removal of Deprecated Methods

All modifications and significant deprecations are updated in the Laravel documentation. All code that utilises a deprecated method should be rewritten in a new way to achieve the same effect if you plan to upgrade a current project to Laravel 10.

Listed below are a few of the deprecations:

  • The technique of Route::home (deprecated in Laravel 9)
  • Deprecated dispatchNow-related functions and methods to promote the usage of dispatchSync, the sole technique that is officially supported for instant dispatch
  • The toBase equivalent of the getBaseQuery method
  • The class MaintenanceModeException
  • The trait MocksApplicationServices
  • The Mail::failures function of the mail fake
  • The $dates property (instead, use $casts)
  • The function assertTimesSent()
  • support for DBAL 2 and Predis 1
  • All relevant doctrine/dbal deprecations since Laravel stopped supporting version 2

Installation and Setup

Create Your First Laravel 10 Project

Note :- Before you create your first Laravel 10 application make sure you have installed PHP version <= 8.1.0 and composer in your local device.

  • Step 1:

    After you installed PHP ( >= 8.1.0 ) & composer, you can either create laravel application using composer or you can globally install the Laravel installer using Composer in order to create new Laravel projects.

    Via Composer:
    composer create-project laravel/laravel example-app        
    via Global installer:
    composer global require laravel/installer
    laravel new example-app    

    Step 2:

    After project created successfully, let move into our project directory and run application using below command,

    cd example-app
    php artisan serve    

    After launching the Artisan development server, you can access your application through your web browser using http://localhost:8000.

    Afterwards, you can begin to delve deeper into the Laravel ecosystem. Additionally, you might want to set up a database configuration.

Laravel 10: Should You Upgrade?

We have thoroughly discussed What’s New in Laravel 10? in the preceding points, so I hope you have a general understanding of What’s New in Laravel 10?

It’s not always necessary to update the Laravel version of your application as soon as a new release is made accessible. As Laravel is an open-source framework, you get ownership of the framework’s codebase each time you install a new Laravel instance on your computer. Consequently, even if the version of the framework your application uses is no longer maintained, it will still run, but you will need to update it yourself.

Thus, it is advised to give application stability priority over framework improvements. Only if your application is stable and operating without any problems in its current version, and the new version either adds a crucial feature or fixes a problem that your application is having, should you think about upgrading to Laravel 10. Furthermore, before putting the upgrade modifications into practice in production.

upgrade laravel 9 to Laravel 10

Have you considered upgrading to Laravel 10? The Laravel core team has put in a lot of effort to create comprehensive documentation that includes a smooth and uncomplicated upgrade guide, addressing all potential breaking changes. Take a look at the official Laravel 10 upgrade guide.

Furthermore, it’s worth keeping an eye on Laravel Shift since Laravel 10 has been launched. Laravel Shift offers a convenient and automated method for upgrading your Laravel version.


Therefore, in conclusion, I tried to discuss What’s New in Laravel 10? in depth in the points above, and I believe you now understand it. with all of their characteristics, benefits, and drawbacks. I urge any laravel developer, regardless of expertise level, to test out these fantastic laravel 10 features. so this is all about What’s New in Laravel 10? Stay tuned for the next article.

Let's share it :

Staff Augmentation

Get Started Within

2 Business Days

    Hire Now

    • 15 days risk free trial
    • 100% NDA-protected
    • Flexible hiring models
    • Guaranteed 160 working-hours
    • Daily/Weekly Project updates