Need help to upgrade laravel from 9 to 10

415 Views Asked by At

I try to upgrade to laravel 10 from 9 I updated my composer.json to this

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "php": "^7.3|^8.0",
    "fideloper/proxy": "^4.4",
    "guzzlehttp/guzzle": "^7.0.1",
    "intervention/image": "^2.6",
    "jantinnerezo/livewire-alert": "^2.2",
    "laravel/framework": "^10.0",
    "laravel/tinker": "^2.8.2",
    "laravel/ui": "^3.3",
    "league/html-to-markdown": "^5.0",
    "livewire/livewire": "^2.5",
    "mews/captcha": "^3.3",
    "pixel418/markdownify": "^2.3",
    "symfony/mailer": "^6.1",
    "wire-elements/modal": "^1.0"
},
"require-dev": {
    "spatie/laravel-ignition": "^2.0",
    "fakerphp/faker": "^1.9.1",
    "laravel/breeze": "^1.3",
    "laravel/sail": "^1.0.1",
    "mockery/mockery": "^1.4.2",
    "nunomaduro/collision": "^7.0",
    "phpunit/phpunit": "^10.0"
},
"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Database\\Factories\\": "database/factories/",
        "Database\\Seeders\\": "database/seeders/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"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"
    ]
},
"extra": {
    "laravel": {
        "dont-discover": []
    }
},
"config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true

}

Running composer update -W I get this

[jaaf@fedora denentzat-2021]$ composer update -W Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1 - Conclusion: don't install fideloper/proxy 4.4.2 (conflict analysis result) - illuminate/contracts[v5.6.0, ..., 5.8.x-dev] require php ^7.1.3 -> your php version (8.2.13) does not satisfy that requirement. - illuminate/contracts[v6.0.0, ..., v6.19.1] require php ^7.2 -> your php version (8.2.13) does not satisfy that requirement. - illuminate/contracts[v7.0.0, ..., v7.28.4] require php ^7.2.5 -> your php version (8.2.13) does not satisfy that requirement. - illuminate/contracts[v8.0.0, ..., v8.11.2] require php ^7.3 -> your php version (8.2.13) does not satisfy that requirement. - Root composer.json requires fideloper/proxy ^4.4 -> satisfiable by fideloper/proxy[4.4.0, 4.4.1, 4.4.2]. - Conclusion: don't install laravel/framework v10.0.1 (conflict analysis result) - Conclusion: don't install laravel/framework v10.0.2 (conflict analysis result) - Conclusion: don't install laravel/framework v10.0.3 (conflict analysis result) ... - Conclusion: don't install laravel/framework v10.38.0 (conflict analysis result) - Conclusion: don't install laravel/framework v10.38.1 (conflict analysis result) - Conclusion: don't install laravel/framework v10.0.0 (conflict analysis result) - fideloper/proxy 4.4.0 requires illuminate/contracts ^5.0|^6.0|^7.0|^8.0 -> satisfiable by illuminate/contracts[v5.0.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev]. - Only one of these can be installed: illuminate/contracts[dev-master, v5.0.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev, v9.0.0-beta.1, ..., 9.x-dev, v10.0.0, ..., 10.x-dev], laravel/framework[v10.0.0, ..., 10.x-dev]. laravel/framework replaces illuminate/contracts and thus cannot coexist with it. - Root composer.json requires laravel/framework ^10.0 -> satisfiable by laravel/framework[v10.0.0, ..., 10.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Running composer why fideloper/proxy I get this

laravel/laravel dev-main requires fideloper/proxy (^4.4) 

What should I do? I need some help as illiminate/contracts seems incompatible with laravel10 but is required by laravel/laravel

1

There are 1 best solutions below

2
silver On

Check the upgrade guide here

first make sure this line "php": "^7.3|^8.0"should have ^8.1 atleast

remove this -> "fideloper/proxy": "^4.4"

or just run composer remove fideloper/proxy

go to your app/Http/Middleware/TrustProxies.php

you should see this line use Fideloper\Proxy\TrustProxies as Middleware;

replace it with use Illuminate\Http\Middleware\TrustProxies as Middleware;