Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GodziLaravel's avatar

How to modify the composer.json to upgrade from laravel 5.8 to 6?

Hello ,

I try to move from the Laravel 5.8 to 6 , I'm wondering what versions of packages should I change also ?

Here my composer.json :

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "doctrine/dbal": "^2.9",
        "fideloper/proxy": "^4.0",
        "guzzlehttp/guzzle": "^6.3",
        "intervention/image": "^2.5",
        "laravel/framework": "5.8.*",
        "laravel/socialite": "^4.1",
        "laravel/tinker": "^1.0",
        "laravelcollective/html": "^5.8",
        "league/oauth2-client": "^2.4",
        "maatwebsite/excel": "^3.1",
        "renatomarinho/laravel-page-speed": "^1.8",
        "spatie/laravel-activitylog": "^3.6"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

#Updates

I changed "laravel/framework": "5.8.*", to "laravel/framework": "6.0.*",

Then I : composer update but the result was :

Your requirements could not be resolved to an installable set of packages.                                                   
                                                                                                                             
  Problem 1                                                                                                                  
    - Conclusion: don't install laravel/framework v6.0.4                                                                     
    - Conclusion: don't install laravel/framework v6.0.3                                                                     
    - Conclusion: don't install laravel/framework v6.0.2                                                                     
    - Conclusion: don't install laravel/framework v6.0.1                                                                     
    - laravelcollective/html v5.8.1 requires illuminate/view 5.8.* -> satisfiable by laravel/framework[v5.8.36], illuminate/v
iew[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8
.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].       
    - laravelcollective/html 5.8.x-dev requires illuminate/view 5.8.* -> satisfiable by laravel/framework[v5.8.36], illuminat
e/view[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v
5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].    
    - laravelcollective/html v5.8.0 requires illuminate/view 5.8.* -> satisfiable by laravel/framework[v5.8.36], illuminate/v
iew[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8
.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].       
    - laravelcollective/html v5.8.1 requires illuminate/view 5.8.* -> satisfiable by laravel/framework[v5.8.36], illuminate/v
iew[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8
.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].       
    - Can only install one of: laravel/framework[v6.0.0, v5.8.36].                                                           
    - don't install illuminate/view 5.8.x-dev|don't install laravel/framework v6.0.0                                         

Thanks

0 likes
8 replies
GodziLaravel's avatar

Here the way I followed to upgrade from 5.8 to 6.0

I changed the version in composer.json to:

"laravel/framework": "6.0.*",

Then composer update

After this I got this error :

    - laravelcollective/html v5.8.1 requires illuminate/view 5.8.* -> satisfiable by laravel/framework[v5.8.36], illumina
view[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24,
.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9]. 

I removed from composer.json "laravelcollective/html": "^5.8",

Then composer update

After I got the error :

In ProviderRepository.php line 208:                                                                                         
                                                                                                                            
  Class 'Collective\Html\HtmlServiceProvider' not found                                                                     
                                                                                                                            
                                                                                                                            
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1                
vagrant@homestead:~/code/irp6$  In ProviderRepository.php line 208:    Class 'Collective\Html\HtmlServiceProvider' not found
                                                                                                                            

I did : composer require laravelcollective/html then composer update

Now it seems okay

If there is any remark please comment

Thanks

GodziLaravel's avatar

@martinbean Thanks

I have one remark :

now the laravel in composer.json is 6.0.* ,

when I check php version php -v I found 7.4.10

but in composer.json it stills : "php": "^7.1.3", , is it a problem or should I change it also ?

Sinnbeck's avatar

Change it, to ensure future people who work on your project, know that you require php 7.4

Snapey's avatar

You have php 7.4 installed

Your composer says that php must be greater than 7.1.3 which it is, so you are ok.

3 likes
martinbean's avatar

@sinnbeck Yes, but it wasn’t end of life when Laravel 6.x was released.

@godzilaravel Your Composer file will specify the lowest version of PHP the application can run on. So if it specifies PHP 7.1.3, but you have 7.4.10 installed, then that’s fine because 7.4 is greater than 7.1.

Sinnbeck's avatar

@martinbean True :) But when upgrading I personally wouldn't allow a php version that is "dead". laravel 6 has almost 2 years left, so it might be a while before the project gets updated again. It is just a suggestion, not a requirement.

Please or to participate in this conversation.