Ferhat Gölge
Computer Worker
Laravel 12 → 13 Migration Guide (Step-by-Step Upgrade Guide)
🚀 Laravel 12 → 13 Migration Guide (Step-by-Step Upgrade Guide)
The Laravel ecosystem continues to evolve rapidly, and Laravel 13 was released in 2026. But is it difficult to upgrade an existing project from Laravel 12 to 13?
In this article, I explain all the necessary steps in a simple and clear way to ensure a smooth transition in real production projects .
📌 Things You Should Know Before Upgrading to Laravel 13
Laravel 13 isn't a groundbreaking release, but it does include some significant changes.
✔️ The most critical changes:
- Minimum PHP: 8.3
- CSRF middleware changed.
- There are minor changes to the queue event structure.
- Caching and serialization have been made more secure.
- Some internal behaviors have been updated.
🧱 1. Upgrade your PHP version.
To use Laravel 13:
Least:
👉 If you are using Docker:
📦 2. Update Your Composer Addictions
Update your composer.json file as follows:
After that:
⚠️ 3. CSRF Middleware Modification
Included with Laravel 13:
❌ Old:
✅ New:
👉 If you are using withoutMiddleware() or custom middleware, be sure to check.
⚙️ 4. Queue & Job Changes
There are small but critical changes to queue events:
❌ Old:
✅ New:
❌ Old:
✅ New:
👉 If you've written an event listener, be sure to check it.
🧠 5. Pay Attention to Cache Usage
Cache security has been improved with Laravel 13.
Problem:
If you are placing an object directly into the cache:
👉 This could now cause problems.
Solution:
- Use arrays
- Use DTO
- or manage serialization permissions
📦 6. Check 3rd Party Packages
This is the most critical point 👇
Don't upgrade without checking these things first:
- Laravel Horizon
- Laravel Excel
- Spatie packages
- Sanctum / Passport
- Debug tools
👉 Make sure they all support Laravel 13.
🧭 Route Behavior Changed (Nothing More Expected)
If you are using domain-based routing, be aware of the following:
👉 In Laravel 13, domain routes now have higher priority.
This can lead to some route conflicts.
🧪 8. Testing and Cleaning
After the upgrade, you must:
🔍 9. Quick Control Commands
Look for the following in your project:
🧩 10. Secure Upgrade Strategy
Proposed production workflow for the project:
- Open a new branch
- Upgrade to PHP 8.3
- Composer update
- Correct package compatibility.
- Run the tests
- Try in a staging environment
- Take it to production
🎯 Result
Laravel 12 → 13 transition:
✅ Not difficult
⚠️ But it requires caution.
Especially:
- Queue
- Cache
- Middleware
- 3rd party packages
If properly checked, the upgrade can be done without any problems.
Frequently Asked Questions
Is it difficult to upgrade from Laravel 12 to 13?
No, upgrading from Laravel 12 to 13 is generally not difficult. However, you need to ensure PHP 8.3 compatibility, check middleware changes, and verify third-party package support. Testing before deploying to production is strongly recommended.
What should I consider before upgrading to Laravel 13?
Before upgrading, ensure your PHP version is 8.3 or higher, update your composer dependencies, and verify that all packages support Laravel 13. You should also review changes related to queue, cache, and middleware.
Can Laravel 13 be used in a production environment?
Yes, Laravel 13 is suitable for production use. However, since it is a major release, it is recommended to test it in a staging environment first and resolve any compatibility issues before deploying it live.