Laravel 10 is Released [New Laravel Pennant Package, Invokable Validation Rules and much more]

Laravel 10

Boom! Laravel 10 is released now. Released on the 14th of Feb this week!

As per the decided yearly cycle, it was released in the first quarter of this year, and we got many new updates in the Laravel development environment. We know, you must be excited about the new features and updates of Laravel 10.

Be ready to take a drive then!

New Features and Updates in Laravel 10

No More Support for PHP v8.0 or Older Than That in Laravel 10

Yes, it will not continue to support PHP v8.0 or older. PHP v8.1 is a minimum required version to move ahead with Laravel 10. And we can expect to see 8.1 features used in the framework, such as read-only properties.

An Official New Package from the Core Team: Laravel Pennant

Laravel Pennant, a package created by the Laravel team that comes in Laravel 10 and provides Feature Flags for your applications.

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

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

All the Validation Rules are Invokable by Default

Back in Laravel 9, if you needed to make the validation rules invokable, you would need to add --invokable flag after the artisan command. Now, it’s not necessary to do that with Laravel 10 because all the validation rules are invokable by default.

For Ex: you need to run this command to create invokable validation rule

php artisan make:rule CustomRule

Native Type Declarations 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.

Refer “Laravel 10 will use native PHP type declarations” for more details.

New Layer in Laravel “Process”

The new layer “Process” in Laravel 10 will make the testing and running CLI processes easier. It comes with straightforward API to ease the testing process.


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

Learn more here – Process Facade Coming to Laravel 10

Profile Option in Laravel 10

Yes, it comes with one more new feature, a --profile option that will make it easy for you to find any slow tests in your application.

The --profile option helps to keep tests fast. Also, fix the slow tests and group them in a better way to make it easier not to run them all the time.

New Method – String Password Helper

The Str::password method helps to generate a secure, random password of a given length. The password will consist of a standard required combination of letters, numbers, symbols, and spaces.

For Ex:

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

Laravel 10 dropped the support for PHP 8.0 or older than that. So if you are planning to upgrade to Laravel 10, you will have to upgrade your PHP to 8.1 or 8.2. Moreover, if you wish to upgrade your project to Laravel 10 then you should fix the below things first from older Laravel to achieve the same results with the latest version of Laravel.

Deprecated Methods

  • Remove the deprecated Route::home method
  • Remove deprecated dispatchNow functionality
  • The getBaseQuery method, which has a toBase equivalent
  • The MaintenanceModeException class
  • The MocksApplicationServices trait
  • The mail fake’s Mail::failures method
  • The $dates property (use $casts instead)
  • The assertTimesSent() method
  • Support for Predis 1 and DBAL 2
  • All related deprecations in doctrine/dbal since Laravel dropped support for version 2

Summary

Laravel 10 seems extremely promising, and our expert team of Laravel Development is excited to cover all the improvements it brings to the Custom Web Application Development environment. Next, we’ll be coming up with the Laravel 10 upgrade guide, curated by our tech team.

Stay Tuned!

Hire the right Laravel Development Company with confidence!

Recent Articles

Browse some of our latest articles...

Prev
Next