Laravel Upgrade Guide: Pitfalls and Best Practices
A practical guide to upgrading Laravel applications. Learn common pitfalls, breaking changes to watch for, and a safe upgrade process.
Before You Start
Laravel upgrades range from "swap a version number" to "weeks of work." Before touching anything:
Check PHP requirements. Laravel 11 requires PHP 8.2. If you're on 8.0, upgrade PHP first.
| Laravel version | Minimum PHP |
|---|---|
| Laravel 8 | PHP 7.3 |
| Laravel 9 | PHP 8.0 |
| Laravel 10 | PHP 8.1 |
| Laravel 11 | PHP 8.2 |
Assess your test coverage. High coverage = confident upgrade. Low coverage = risky upgrade.
| Test coverage | Upgrade risk |
|---|---|
| Above 70% | Low—tests will catch most issues |
| 40-70% | Medium—test critical paths manually |
| Below 40% | High—consider adding tests first |
Check third-party packages. Run composer outdated and check each package supports your target Laravel version. This is often where upgrades get stuck.
Common Breaking Changes
Every major version breaks something. Here are the patterns:
Laravel 9 → 10:
| Change | Impact | Fix |
|---|---|---|
| PHP 8.1 minimum | High | Upgrade PHP first |
| Eloquent strict mode | Medium | Fix lazy loading issues |
| $dates property deprecated | Low | Use $casts instead |
Laravel 10 → 11:
| Change | Impact | Fix |
|---|---|---|
| PHP 8.2 minimum | High | Upgrade PHP |
| Directory structure changes | Medium | Adapt to new layout |
| Config file updates | Medium | Compare with fresh install |
The official upgrade guide covers everything, but these are the ones that catch people.
The Upgrade Process
Step 1: Branch and backup
Never upgrade on main. Create a branch and make sure you can restore if needed.
Step 2: Update PHP if necessary
Do this separately from the Laravel upgrade. One change at a time.
Step 3: Update composer.json
Change the laravel/framework version requirement. For major versions, you'll also need to update other first-party packages (laravel/sanctum, laravel/horizon, etc.).
Step 4: Run composer update
This is where you find out which packages don't support the new version yet.
Step 5: Compare config files
Create a fresh Laravel installation and compare config files. Look for new options and changed defaults.
Step 6: Run tests
Everything passing? Great. Tests failing? Fix them before continuing.
Step 7: Manual testing
Even with good test coverage, click around. Check the critical paths: login, main features, payments.
Testing Thoroughly
Your testing priority:
| Priority | What to test | Why |
|---|---|---|
| 1 | Authentication | Breaking auth breaks everything |
| 2 | Payments | Money issues are bad |
| 3 | Core business logic | The reason your app exists |
| 4 | Third-party integrations | APIs change behavior |
| 5 | Admin functions | Important but lower risk |
If you don't have automated tests, create a manual testing checklist:
- User can register
- User can log in
- User can reset password
- Main workflow completes
- Payment processes (test mode)
- Emails send correctly
- File uploads work
- Admin access works
Common Mistakes
Skipping versions. Going 8 → 11 in one jump is asking for trouble. Upgrade step by step: 8 → 9 → 10 → 11. It takes longer but each step is manageable.
Ignoring deprecation warnings. Those warnings become errors in the next version. Fix them as you see them.
Upgrading on Friday. Don't. Give yourself a full week to deal with issues.
Not checking the queue. Jobs pushed before the upgrade may fail after the upgrade if method signatures changed. Clear or drain your queues before deploying.
Rushing to production. Deploy to staging first. Let it sit for a day. Check logs. Then production.
Timeline expectations
| Upgrade type | Time estimate |
|---|---|
| Minor version (10.1 → 10.2) | 1-2 hours |
| Major version (10 → 11) | 1-2 days |
| Multiple major versions (8 → 11) | 1-2 weeks |
| Major version with poor test coverage | Add 50-100% |
If you're multiple versions behind and don't have tests, consider whether a gradual upgrade or a structured modernization makes more sense.
Need help?
We've upgraded dozens of Laravel applications, from quick version bumps to major overhauls of neglected codebases. If you're stuck or want to avoid the hassle, we can help.
📬 Get Engineering Insights
Practical articles on MVP development, legacy modernization, and building products that scale. Delivered to your inbox.
No spam. Unsubscribe anytime. We respect your privacy.
The Ordinary Company
Product-minded engineers helping startups build and scale. 50+ projects delivered.
Ready to Build Your Project?
Let's discuss how we can help bring your ideas to life. Free consultation, no strings attached.