anjanesh's avatar

Upgrading Laravel 12 to 13 with some deps without using Shift

I have a Laravel 12 site on PHP 8.2 at cloudways. I need to upgrade this to Laravel 13. How complicated would it be - anything to watch out for ? (Can't spend $99 on Shift for this pet project)

    "require": {
        "php": "^8.2",
        "elasticsearch/elasticsearch": "^9.2",
        "intervention/image": "^3.11",
        "intervention/image-laravel": "^1.5",
        "laravel/framework": "^12.0",
        "laravel/sanctum": "^4.1",
        "laravel/scout": "^10.22",
        "laravel/tinker": "^2.10.1",
        "maatwebsite/excel": "^3.1",
        "spatie/laravel-permission": "^6.20",
        "spatie/laravel-sitemap": "^7.3"
    },

What command should I run to upgrade this safely ?

0 likes
4 replies
LaryAI's avatar
Level 58

Certainly! Here’s a safe and practical approach for upgrading from Laravel 12 to 13 without using Laravel Shift, considering your posted dependencies.


1. Review Laravel 13 Upgrade Guide First

  • Check the Laravel 13 Upgrade Guide for all breaking changes and necessary manual steps.
  • Check for breaking changes in any packages you use, especially spatie/laravel-permission, maatwebsite/excel, etc.

2. Check Package Compatibility

  • Before upgrading Laravel, verify that ALL your current dependencies support Laravel 13.
    Good commands for this:
    composer why-not laravel/framework 13.*
    
    and check the GitHub repos/changelogs of key packages for Laravel 13 support.

3. Update composer.json

Change:

"laravel/framework": "^12.0",

to:

"laravel/framework": "^13.0",

For extra safety, you might bump related official packages (tinker, sanctum, scout, etc) to their latest versions that support Laravel 13.


4. Run Composer Update

This is the command to upgrade your dependencies:

composer update

If Composer can't resolve dependencies, you may need to increment some package versions in your composer.json or temporarily remove a package that doesn't support Laravel 13 yet.


5. Manually Apply Upgrade Steps

Follow the official Upgrade Guide:

  • Check if your app uses any features that have changed or been removed.
  • Check for any config file changes/new config. You can compare your config files with the stub versions using laravel-shift.com/compare.
  • Run tests!

6. Test Thoroughly

  • Run your automated tests:
    php artisan test
    
  • Test your site in a staging/dev environment if possible, not production.

7. Deploy

  • Once you’ve verified locally/staging, deploy to production.

Example Full Command Series

# Backup your project (highly recommended)
git commit -am "Backup before Laravel 13 upgrade"

# Bump your Laravel version in composer.json
# (use any text editor)

# Try the update
composer update

# If you run into a dependency error, check which package is blocking Laravel 13

composer why-not laravel/framework 13.*
# Adjust offending package versions as needed

# Run migrations, clear cache, etc
php artisan migrate
php artisan config:cache
php artisan route:clear
php artisan view:clear

# Run tests
php artisan test

Summary of Things to Watch Out For

  • Carefully review Laravel 13 upgrade notes.
  • Vendor packages may lag — check for Laravel 13 support across your dependencies.
  • If you hit unsolvable dependency issues, you may need to update or temporarily remove a package.
  • Test before deploying!

You do not need Shift for this upgrade. It’s mostly a composer update plus the manual steps in the upgrade guide.

If you hit any specific errors during composer update, paste them here and I can help debug!

Let me know if you need advice for a specific package in your list.

Glukinho's avatar

The process is more or less the same as described in Upgrade guide: https://laravel.com/docs/13.x/upgrade

First try composer require --dry-run and see errors. If there aren't, you're good. Otherwise deal with packages versions.

Of course it is always a good idea to backup code/data and run the whole process on some staging environment (copied from production maybe) first.

imrandevbd's avatar

Change your composer.json for the framework to "laravel/framework": "^13.0". You will also need to bump sanctum, scout, and tinker to their next major versions based on what the L13 upgrade guide says.

Then run this exact command: composer update laravel/framework -W

The -W (--with-all-dependencies) flag is completely mandatory here. It tells composer to upgrade all the underlying Symfony packages simultaneously.

jlrdw's avatar

I suggest do it in development then push as needed. And do backup first everything including your database.

Please or to participate in this conversation.