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

Yonibrese's avatar

Update to Laravel 10 from Laravel 9

Hello,

I am trying to update my Laravel project from version 9 to version 10, but I keep on running into a wall.

I am currently running PHP 8.1.12

The following is the requirements from my composer.json file that according to the documentation I need to use to upgrade to Laravel 10

"require": {
        "php": "^8.1.0",
        "fruitcake/laravel-cors": "^3.0",
        "guzzlehttp/guzzle": "^7.2",
        "intervention/image": "^2.7",
        "laravel/framework": "^10.0.0",
        "laravel/sanctum": "^3.2.0",
        "laravel/tinker": "^2.8",
        "league/flysystem-ftp": "3.0",
        "league/flysystem-sftp-v3": "3.6.0",
        "maatwebsite/excel": "^3.1",
        "pbmedia/laravel-ffmpeg": "*",
        "php-ffmpeg/php-ffmpeg": "*",
        "spatie/image": "^2.2",
        "spatie/laravel-backup": "^8.1",
        "spatie/laravel-permission": "^5.5",
        "spatie/pdf-to-image": "^2.2"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/dusk": "^7.4",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.0",
        "spatie/laravel-ignition": "^2.0"
    }

when I run php composer update -W I get the following error:

 - illuminate/contracts[v6.0.0, ..., v6.19.1] require php ^7.2 -> your php version (8.1.12) does not satisfy that requirement.
    - illuminate/contracts[v7.0.0, ..., v7.28.4] require php ^7.2.5 -> your php version (8.1.12) does not satisfy that requirement.
    - illuminate/contracts[v8.0.0, ..., v8.11.2] require php ^7.3 -> your php version (8.1.12) does not satisfy that requirement.
    - Root composer.json requires fruitcake/laravel-cors ^3.0 -> satisfiable by fruitcake/laravel-cors[v3.0.0, 3.0.x-dev].
    - Conclusion: don't install laravel/framework v10.0.1 (conflict analysis result)
  	- [More laravel 10 versions with the same issue]
    - Conclusion: don't install laravel/framework v10.0.0 (conflict analysis result)
    - fruitcake/laravel-cors[v3.0.0, ..., 3.0.x-dev] require illuminate/contracts ^6|^7|^8|^9 -> satisfiable by illuminate/contracts[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].
    - Only one of these can be installed: illuminate/contracts[v5.1.1, ..., 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, v11.0.0, ..., 11.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.0 -> satisfiable by laravel/framework[v10.0.0, ..., 10.x-dev].

so how do I fix this Issue, according to the error message I need to "Install illuminate/contracts ^6|^7|^8|^9" but, the message also says that I cant use this because "laravel/framework replaces illuminate/contracts and thus cannot coexist with it"

can anyone help?

0 likes
2 replies
tykus's avatar
tykus
Best Answer
Level 104

You don't need the fruitcake/laravel-cors package anymore

Note for users upgrading to Laravel 9, 10 or higher

This package is deprecated because all supported Laravel versions now include the CORS middleware in the core.

Since Laravel 9.2, this Middleware is included in laravel/framework. You can use the provided middleware, which should be compatible with the Middleware and config provided in this package. See https://github.com/laravel/laravel/pull/5825/files for the changes.

Steps to upgrade:

Remove "fruitcake/laravel-cors" from your composer.json Replace \Fruitcake\Cors\HandleCors::class, with \Illuminate\Http\Middleware\HandleCors::class, in app/Http/Kernel.php See https://github.com/fruitcake/php-cors for advanced usage. The config stays the same.

https://github.com/fruitcake/laravel-cors

You might have to check multiple of the project's dependencies like this... the error message(s) generally point to the offending package like above

Please or to participate in this conversation.