logo
OUR WORK

Our work reflects our expertise in delivering innovative, scalable, and user-focused digital solutions. From custom software to modern web and mobile applications, we help businesses transform ideas into impactful products that drive growth, enhance user experience, and create long-term value in competitive markets.

Learn MoreLearn More
CAREERS

Empower your professional journey at Tec-Sense. We are a collective of thinkers, creators, and problem-solvers dedicated to pushing technical boundaries. If you’re passionate about innovation and eager to shape the future of software development, explore our open roles and build your legacy with us today.

Join UsJoin Us

Upgrading from Laravel 9.x to Laravel 10.x: A Comprehensive Guide

Upgrading from Laravel 9.x to Laravel 10.x: A Comprehensive Guide
  • 09-12-2023
  • Development & Tech

Upgrading from Laravel 9.x to Laravel 10.x: A Comprehensive Guide

If you’re currently using Laravel 9.x for your website or bespoke web app, it’s crucial to stay ahead of the curve and upgrade to Laravel 10.x, which was released on February 14, 2023. This ensures that your system remains secure and benefits from the latest features. In this guide, we’ll walk you through the essential steps to seamlessly upgrade from Laravel 9.x to Laravel 10.x while preserving the

Key Points for Upgrade

1. Updates to Dependencies

A. PHP 8.1 + Required

Ensure that your system runs PHP 8.1.0 or later, as Laravel 10.x mandates this version. Check your PHP version using the command:

./vendor/bin/sail php -v

B. Needs Composer 2.2.0.

Update dependencies in your composer.json file:

“laravel/framework”: “^10.0”, “laravel/sanctum”: “^3.2”, “doctrine/dbal”: “^3.0”, “spatie/laravel-ignition”: “^2.0”, “laravel/passport”: “^11.0”

If using PHPUnit 10, remove processUncoveredFiles from your phpunit.xml configuration:

“nunomaduro/collision”: “^7.0”, “phpunit/phpunit”: “^10.0”

Update any third-party packages to match Laravel 10.x requirements.

2. Stability at a Minimum

Ensure that the minimum-stability in your composer.json is set to “stable” or remove the setting if it’s set by default.

“minimum-stability”: “stable”

3. Update a Web Application

Modify the code invoking usePublicPath for a customized ‘public path’:

app()->usePublicPath(__DIR__.’/public’);

4. Cache Refresh

Use Laravel’s new cache:prune-stale-tags function to handle Redis cache tag support efficiently. Add this Artisan command to your App\Console\Kernel class:

$schedule->command(‘cache:prune-stale-tags’)->hourly();

5. Database Expression and Database Update

Rewrite database expressions using DB::raw. Update manually casted database expressions to invoke the getValue method.

use Illuminate\Support\Facades\DB; $expression = DB::raw(‘select 1’); $string = $expression->getValue(DB::connection()->getQueryGrammar());

6. Constructor of Query Exceptions

Adjust code if your application manually throws

Illuminate\Database\QueryException.

7. Columns ULID

Specify column name when invoking the ULID method during migration:

$table->ulid(‘ulid’);

8 . Update Eloquent

A. ‘Dates’ Model Property

Replace the deprecated $dates field with the $casts property:

protected $casts = [ ‘deployed_at’ => ‘datetime’, ];

B. Method of Relationship

Remove the getBaseQuery method on the

Illuminate\Database\Eloquent\Relations\Relation class.

9. Logging Update

A. Monolog 3

Upgrade Monolog to version 3.x if your application interacts directly with Monolog.

10. Update Queues

Replace obsolete approaches Bus::dispatchNow and dispatch_now with Bus::dispatchSync and dispatch_sync.

11. Update Routing

A. Middleware Aliases

Rename $routeMiddleware to $middlewareAliases in App\Http\Kernel.

B. Return Values of Rate Limiters

Handle returned values when executing RateLimiter::attempt method.

C. The Redirect::home Technique

Replace deprecated Redirect::home with explicit route redirection:

return Redirect::route(‘home’);

12. Update Testing

Replace deprecated MocksApplicationServices trait with Event::fake, Bus::fake, and Notification::fake.

13. Update Validation

Adjust closure-based custom validation rules using the $fail callback.

Additional Information

Check the Laravel GitHub repository for more changes and updates. Some updates are optional but recommended for a smooth transition.

Wrapping Up

Thoroughly read the Laravel 10.x documentation before upgrading to minimize the risk of technical issues. For expert assistance in Laravel development, Tec Sense offers comprehensive services, from customization to maintenance. Contact us for a free quote at [email protected].

About Image
about-logo

About Tec-sense

Our team brings together designers, developers, strategists, and marketing experts under one roof, making collaboration seamless and execution faster.

Learn More

Author

Authortec-sense

Recent Posts

10 Mistakes Founders Make When Building Their First SaaS MVP
  • 03-07-2026
  • SaaS Development

10 Mistakes Founders Make When Building Their First SaaS MVP

Vue.js vs React in 2026: Which Is Better for Growing Startups?
  • 29-06-2026
  • React

Vue.js vs React in 2026: Which Is Better for Growing Startups?

From Idea to MVP in 30 Days: A SaaS Founder’s Playbook (With the Right Dev Partner)
  • 22-06-2026
  • SaaS Development

From Idea to MVP in 30 Days: A SaaS Founder’s Playbook (With the Right Dev Partner)

Where We Make Waves

Industry Recognition

Clutch

Clutch Logo

Featured as a trusted service provider with verified client reviews and strong project outcomes.

2014

Upwork

Upwork Logo

A trusted development partner with a proven track record and long-term collaborations.

2014

Behance

Behance Logo

Home to our best creative and UI/UX design work — curated and showcased globally.

2012

Google

Google Logo

Five-star rated for the way we treat our partners.

2014