Quick Summary:

With the ever-growing demand for exceptional services and updates within the market, the core team at Laravel is determined to leave no stone unturned to make it the first choice of business owners. Following this intent, they are here with the latest investment in their franchise with Laravel 10. So, here we are to tell you about What’s New in Laravel 10, along with the latest features and updates that will grab the attention of developers and business owners and will motivate them to upgrade their existing Laravel applications.

Table of Contents

Laravel 10 Release Date

Laravel and its first-party packages follow the Semantic Versioning methodology, which entails releasing major updates to the framework once a year during the first quarter. Meanwhile, minor updates can be released on an as-needed basis. With Laravel 10 release date on February 13, 2023, the latest version of the framework is here, boasting exciting new features and updates. Previously, a new Laravel version was released every six months. However, after the release of Laravel 9 in February 2022, the core team shifted to an annual release schedule which is as follows:

🟠 Laravel 9: February 8, 2022,
🟠 Laravel 10: February 13, 2023,
🟠 Laravel 11: February 6, 2024

According to the official Laravel News Page, Laravel 9 will receive scheduled bug fixes until August 8, 2023, and security fixes until February 6, 2024. Meanwhile, Laravel 10 is expected to receive bug fixes until August 6, 2024, and security fixes until February 4, 2025.

What’s New in Laravel 10: Latest Features and Updates

The core team behind the framework is always working to bring the best to its users, which is why it’s recommended to use version constraints like ‘^10.0’ when referring to the framework or its components in an application or package. This is because newer versions may come with noteworthy changes and updates. The current Laravel 10 also features several substantial improvements, which will benefit product owners. Let’s take a closer look at these changes:

🟠 PHP 8.0 Support Dropped

Laravel 10 no longer supports PHP 8.0, and you must upgrade to PHP 8.1 or 8.2. While it’s not necessary to immediately update your Laravel applications to the latest version of Laravel as soon as it’s released. However, thorough testing is still recommended, especially for projects with paid clients or employees. Additionally, support for Predis v1 has been discontinued along with PHP 8.0, and you must upgrade to Predis v2.

🟠 Introduced Laravel Pennant

The Laravel Pennat is a straightforward and lightweight feature flag package, allowing you to roll out new features within your application easily. It includes an A/B test interface design, supports trunk-based development strategies, and more. The feature flags allow turning a feature on or off at runtime without changing the code.

🟠 Easy Process Handling

Laravel offers a straightforward and extensive API for the Symphony Process component, enabling you to run external processes in your Laravel application easily. This process functionality addresses common use cases, providing a highly improved development experience.

🟠 Invokable Validation Rules by Default

With Laravel 9, the –invokable flag was necessary to be added after the artisan command when creating a new Invokable rule. However, in Laravel 10, you can simply run the following command to create a new Invokable rule:

Copy Text
php artisan make:rule CustomRule

In addition, the boilerplate code is straightforward and easy to comprehend, making it less intimidating for developers to create their own custom validation rules.

🟠 Application Skeleton Code with Type Declarations

In the past, Laravel utilized DocBlocks in its skeleton code to clearly explain the function of a particular code and the responses or parameters it delivers. However, with the newest Type Declarations, all user codes within the framework will now feature type-hints and return types. These enhancements have additional benefits and do not impact the core framework’s backward compatibility. This includes Method Arguments, Return Types, elimination of unnecessary annotations when feasible, excluding Types property, and allowing users to access closure arguments.

🟠 Removed dispatchNow()

In Laravel 10, the ‘dispatchNow()’ method has been removed as it was deprecated in Laravel 9 in favor of ‘dispatchSync()’. It is essential to replace it in all your existing projects, as it constitutes a breaking change, but the solution is simple.

🟠 Deprecations from Laravel 9

With the recent update to Laravel, the team is phasing out deprecated methods in the Laravel 10 branch that were present in Laravel 9. The update to the Laravel documentation regarding the upgrade process, including a list of all deprecated methods and packages, is present within the documentation. Those planning to upgrade their projects to Laravel v10 will need to rewrite their code with a new approach to achieve the desired outcome. Some of the deprecations and deletions from 9 to the master branch include:

  • The Route::home method, which was deprecated in Laravel 9
  • The getBaseQuery method, which has a toBase equivalent
  • The MaintenanceModeException class, is no longer in use
  • The MocksApplicationServices trait
  • The Mail::failures method in the mail fake
  • A recommendation to use $casts instead of the deprecated $dates property
  • The assertTimesSent() method
  • Support for Predis 1 and doctrine/dbal 2 are no longer available
  • All related deprecations in doctrine/dbal since Laravel has dropped support for version 2.

Should You Upgrade to Laravel 10?

It’s important to note that Laravel is an open-source framework, so every time you install a new instance on your device, you own the codebase. Even if your version is no longer supported, your application will still be operational. However, you will be responsible for maintaining the version on your own. It’s advisable to prioritize stability over upgrading the framework. Consider upgrading to Laravel 10 only if:

  • Your current Laravel app is stable and functioning properly.
  • The upgrade will bring a necessary feature or resolve a critical bug that will enhance the performance of your app.
  • You have thoroughly tested your app before implementing the upgrade in the production environment.

How to Upgrade from Laravel 9 to Laravel 10

With the official release of Laravel v10, upgrading your current Laravel application to the new version will be a breeze with Laravel 10.x Shift. This tool automates upgrading from Laravel 9 to Laravel 10, saving you up to 2 hours of valuable time. It’s important to note that both Laravel and Laravel 10.x Shift will receive regular updates, and those utilizing Shift can request a rerun if needed.

🟠 Requirements

To upgrade your current Laravel application to Laravel 10, a few essential requirements must be met:

  • Your Laravel application must be on Laravel 9 or above
  • Your server must have PHP 8.1 or a higher version installed.

🟠 Core Upgrades

The Shift automates many of the upgrades outlined in the Laravel Upgrade Guide, including-

  • Upgrades to the core project files of Laravel
  • New methods for changes made to interfaces
  • Addition of PHP-type hints to the Laravel app
  • Conversion of the deprecated $dates property to $casts
  • Update of core dependencies for Laravel 10 and PHP 8.1
  • Removal of redundant typing within PHP DocBlocks
  • Detection of deprecated code within the app code.

🟠 Additional Upgrades

Along with the core upgrades, the Shift also provides additional upgrades mentioned in the Laravel Upgrade Guide, such as:

  • Modernization of PHP syntax, including the use of the null safe operator and short arrays
  • Ability to apply your preferred code style
  • Adoption of tuple syntax and class-based routes
  • Conversion to anonymous migrations
  • Automated changes required for PHPUnit 9
  • Transformation of Faker property access to method calls
  • Updates to config files to reflect the Laravel 10 versions
  • Increased dependency constraints for popular packages.

🟠 Manual Upgrades

While the Laravel 10.x Shift aims to automate as many upgrades as possible; there may be some updates that cannot be done automatically. In such cases, it detects these updates and provides detailed instructions in the form of comments within the pull request, outlining the necessary steps for manual implementation.

Although the Shift endeavors to detect and automate upgrades for popular dependencies, manual implementation may still be required. It is recommended to review the changelog for dependencies and any additional changes to ensure a successful upgrade.

Conclusion

This concludes our overview of What’s New in Laravel 10, including its features, updates, and requirements. We hope this blog post has given you significant insight into the latest version of the framework. However, if you are a business owner, unsure about upgrading your existing Laravel application to Laravel 10, or if you are considering a new project and wonder if Laravel is the right solution for your needs, Hire Laravel Development Company like Bacancy. Our team of experts will guide you through every step of your web application development journey, alleviating any stress or concerns you may have.

Need to Upgrade Your App But Don't Have the Expertise?

Connect with our experienced Laravel developers to upgrade your app to the latest version without stretching your budget and time

UPGRADE YOUR APP NOW

Build Your Agile Team

Hire Skilled Developer From Us

[email protected]

Your Success Is Guaranteed !

We accelerate the release of digital product and guaranteed their success

We Use Slack, Jira & GitHub for Accurate Deployment and Effective Communication.

How Can We Help You?