Data
/laravel-agent:upgrade:laravel
Automated Laravel version upgrades
Overview
Safely upgrade your Laravel application to a newer version with automated compatibility checks, code migrations, and testing.
Usage
/laravel-agent:upgrade:laravel [target-version]
Examples
/laravel-agent:upgrade:laravel 11 # Upgrade to Laravel 11
/laravel-agent:upgrade:laravel 11.x # Upgrade to latest Laravel 11.x
/laravel-agent:upgrade:laravel latest # Upgrade to latest version
/laravel-agent:upgrade:laravel --check-only # Only check compatibility
/laravel-agent:upgrade:laravel --dry-run # Show changes without applying
Supported Upgrade Paths
| From | To | Complexity |
|---|---|---|
| Laravel 10.x | Laravel 11.x | Medium |
| Laravel 9.x | Laravel 10.x | Medium |
| Laravel 8.x | Laravel 9.x | Medium |
| Laravel 7.x | Laravel 8.x | High |
Upgrade Process
- Pre-Upgrade Assessment - Check PHP version, dependencies, git status
- Dependency Analysis - Identify package compatibility
- Breaking Changes Detection - Find affected files
- Backup Creation - Create backup branch and database backup
- Upgrade Execution - Update composer.json, migrate config
- Code Migrations - Apply automatic code changes
- Verification - Run tests, clear caches
Laravel 10 → 11 Changes
app/Http/Kernel.php→bootstrap/app.phpapp/Console/Kernel.php→routes/console.phpapp/Exceptions/Handler.php→bootstrap/app.php- Middleware registration changes
- Service provider changes
Options
| Option | Description |
|---|---|
--check-only |
Only check compatibility, don't upgrade |
--dry-run |
Show changes without applying |
--no-backup |
Skip backup creation |
--force |
Proceed even with warnings |
--step |
Upgrade one minor version at a time |
Rollback
If the upgrade fails:
# Restore composer.lock
cp composer.lock.backup composer.lock
composer install
# Or use git
git checkout pre-upgrade-backup
# Clear caches
php artisan optimize:clear
Best Practices
- Always backup before upgrading
- Upgrade in staging before production
- Run full test suite before and after
- Review the official upgrade guide
- Upgrade dependencies first if possible
- Keep git history clean with atomic commits
See Also
- /laravel-agent:migrate:from-legacy - Major version migrations
- /laravel-agent:analyze:codebase - Pre-upgrade health check
- /laravel-agent:test:coverage - Verify test coverage