skip to Main Content

I am upgrading from laravel 8 to 10 and to php 8.2

I cleared out my composer.json and painfully added each package via "composer require" so i could get all the correct versions.

My last stumbling block in getting aws S3 to work. I can not seem to find a package that will work with laravel 10 dependancies.

Has any one got it to work with v10 and s3?

The package i used with laravel 8 sociallydev/spaces-api has some old dependancies that can not work with v10.

I tried

composer require league/flysystem-aws-s3-v3 ~1.0

 Problem 1
- league/flysystem-aws-s3-v3[1.0.0, ..., 1.0.13] require league/flysystem ~1.0 -> found league/flysystem[1.0.0, ..., 1.1.10] but it conflicts with your root composer.json require (^3.15.1).
- league/flysystem-aws-s3-v3[1.0.15, ..., 1.0.30] require league/flysystem ^1.0.40 -> found league/flysystem[1.0.40, ..., 1.1.10] but it conflicts with your root composer.json require (^3.15.1).
- Root composer.json requires league/flysystem-aws-s3-v3 ~1.0 -> satisfiable by league/flysystem-aws-s3-v3[1.0.0, ..., 1.0.30].

i also tried

composer require league/flysystem-aws-s3-v3 ~3.0
Problem 1
- league/flysystem-aws-s3-v3[3.12.1, ..., 3.15.0] require aws/aws-sdk-php ^3.220.0 -> satisfiable by aws/aws-sdk-php[3.220.0, ..., 3.275.4].
- league/flysystem-aws-s3-v3[3.0.0, ..., 3.10.3] require aws/aws-sdk-php ^3.132.4 -> satisfiable by aws/aws-sdk-php[3.132.4, ..., 3.275.4].
- aws/aws-sdk-php[3.132.4, ..., 3.173.19] require guzzlehttp/psr7 ^1.4.1 -> found guzzlehttp/psr7[1.4.1, ..., 1.9.1] but it conflicts with your root composer.json require (^2.5.0).
- aws/aws-sdk-php[3.173.20, ..., 3.198.8] require guzzlehttp/psr7 ^1.7.0 -> found guzzlehttp/psr7[1.7.0, ..., 1.9.1] but it conflicts with your root composer.json require (^2.5.0).
- aws/aws-sdk-php[3.199.0, ..., 3.275.4] require guzzlehttp/promises ^1.4.0 -> found guzzlehttp/promises[1.4.0, ..., 1.5.3] but it conflicts with your root composer.json require (^2.0.0).
- Root composer.json requires league/flysystem-aws-s3-v3 ~3.0 -> satisfiable by league/flysystem-aws-s3-v3[3.0.0, ..., 3.15.0].

and finally

composer require league/flysystem-aws-s3-v3
Problem 1
- league/flysystem-aws-s3-v3[3.12.1, ..., 3.15.0] require aws/aws-sdk-php ^3.220.0 -> satisfiable by aws/aws-sdk-php[3.220.0, ..., 3.275.4].
- league/flysystem-aws-s3-v3[3.0.0, ..., 3.10.3] require aws/aws-sdk-php ^3.132.4 -> satisfiable by aws/aws-sdk-php[3.132.4, ..., 3.275.4].
- league/flysystem-aws-s3-v3[1.0.0, ..., 1.0.13] require league/flysystem ~1.0 -> found league/flysystem[1.0.0, ..., 1.1.10] but it conflicts with your root composer.json require (^3.15.1).
- league/flysystem-aws-s3-v3[1.0.15, ..., 1.0.30] require league/flysystem ^1.0.40 -> found league/flysystem[1.0.40, ..., 1.1.10] but it conflicts with your root composer.json require (^3.15.1).
- league/flysystem-aws-s3-v3[2.0.0, ..., 2.5.0] require league/flysystem ^2.0.0 -> found league/flysystem[2.0.0, ..., 2.5.0] but it conflicts with your root composer.json require (^3.15.1).
- aws/aws-sdk-php[3.131.0, ..., 3.173.19] require guzzlehttp/psr7 ^1.4.1 -> found guzzlehttp/psr7[1.4.1, ..., 1.9.1] but it conflicts with your root composer.json require (^2.5.0).
- aws/aws-sdk-php[3.173.20, ..., 3.198.8] require guzzlehttp/psr7 ^1.7.0 -> found guzzlehttp/psr7[1.7.0, ..., 1.9.1] but it conflicts with your root composer.json require (^2.5.0).
- aws/aws-sdk-php[3.199.0, ..., 3.275.4] require guzzlehttp/promises ^1.4.0 -> found guzzlehttp/promises[1.4.0, ..., 1.5.3] but it conflicts with your root composer.json require (^2.0.0).
- Root composer.json requires league/flysystem-aws-s3-v3 * -> satisfiable by league/flysystem-aws-s3-v3[1.0.0, ..., 1.0.30, 2.0.0, ..., 2.5.0, 3.0.0, ..., 3.15.0].

here is my composer.json

{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
    "asm89/stack-cors": "*",
    "brick/math": "*",
    "dnoegel/php-xdg-base-dir": "*",
    "doctrine/inflector": "^2.0",
    "doctrine/instantiator": "^2.0",
    "doctrine/lexer": "^3.0",
    "dragonmantank/cron-expression": "^3.3",
    "egulias/email-validator": "^4.0",
    "elic-dev/laravel-site-protection": "^1.1",
    "facade/ignition-contracts": "^1.0",
    "guzzlehttp/guzzle": "^7.7.0",
    "guzzlehttp/promises": "^2.0.0",
    "guzzlehttp/psr7": "^2.5.0",
    "hamcrest/hamcrest-php": "^2.0",
    "laravel/framework": "^10.10",
    "laravel/sanctum": "^3.2",
    "laravel/tinker": "^2.8",
    "laravel/ui": "^4.2",
    "laravelcollective/html": "^6.4",
    "league/commonmark": "^2.4",
    "league/flysystem": "^3.15.1",
    "monolog/monolog": "^3.4",
    "myclabs/deep-copy": "^1.11",
    "nesbot/carbon": "^2.68",
    "nikic/php-parser": "^4.16",
    "opis/closure": "^3.6",
    "phar-io/manifest": "^2.0",
    "phar-io/version": "^3.2",
    "phpdocumentor/reflection-docblock": "^5.3",
    "phpdocumentor/type-resolver": "^1.7",
    "phpoption/phpoption": "^1.9",
    "phpspec/prophecy": "^1.1",
    "psr/container": "^2.0",
    "psr/event-dispatcher": "^1.0",
    "psr/http-message": "^1.0.1",
    "psr/log": "^3.0",
    "psr/simple-cache": "^3.0",
    "psy/psysh": "^0.11.18",
    "ralouphie/getallheaders": "^3.0",
    "ramsey/collection": "^2.0",
    "ramsey/uuid": "^4.7",
    "sebastian/code-unit-reverse-lookup": "^3.0",
    "sebastian/comparator": "^5.0",
    "sebastian/diff": "^5.0",
    "sebastian/environment": "^6.0",
    "sebastian/exporter": "^5.0",
    "sebastian/global-state": "^6.0",
    "sebastian/object-enumerator": "^5.0",
    "sebastian/object-reflector": "^3.0",
    "sebastian/recursion-context": "^5.0",
    "sebastian/resource-operations": "^3.0",
    "sebastian/type": "^4.0",
    "sebastian/version": "^4.0",
    "spatie/laravel-permission": "^5.10",
    "spatie/laravel-sluggable": "*",
    "swiftmailer/swiftmailer": "^5.4",
    "symfony/css-selector": "^6.3",
    "symfony/deprecation-contracts": "^3.3",
    "symfony/error-handler": "^6.3",
    "symfony/event-dispatcher": "^6.3",
    "symfony/event-dispatcher-contracts": "^3.3",
    "symfony/finder": "^6.3",
    "symfony/http-foundation": "^6.3",
    "symfony/http-kernel": "^6.3",
    "symfony/mime": "^6.3",
    "symfony/polyfill-ctype": "^1.27",
    "symfony/polyfill-iconv": "^1.27",
    "symfony/polyfill-intl-grapheme": "^1.27",
    "symfony/polyfill-intl-idn": "^1.27",
    "symfony/polyfill-intl-normalizer": "^1.27",
    "symfony/polyfill-mbstring": "^1.27",
    "symfony/polyfill-php72": "^1.27",
    "symfony/polyfill-php73": "^1.27",
    "symfony/polyfill-php80": "^1.27",
    "symfony/process": "^6.3",
    "symfony/routing": "^6.3",
    "symfony/service-contracts": "^3.3",
    "symfony/string": "^6.3",
    "symfony/translation": "^6.3",
    "symfony/translation-contracts": "^3.3",
    "symfony/var-dumper": "^6.3",
    "theseer/tokenizer": "^1.2",
    "tijsverkoyen/css-to-inline-styles": "^2.2",
    "vemcogroup/laravel-sparkpost-driver": "^5.0.5",
    "vlucas/phpdotenv": "^5.5",
    "voku/portable-ascii": "^2.0",
    "webmozart/assert": "^1.11"
},
"require-dev": {
    "fakerphp/faker": "^1.9.1",
    "laravel/pint": "^1.0",
    "laravel/sail": "^1.18",
    "mockery/mockery": "^1.4.4",
    "nunomaduro/collision": "^7.7",
    "phpdocumentor/reflection-common": "^2.2",
    "phpunit/phpunit": "^10.1",
    "spatie/laravel-ignition": "^2.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-update-cmd": [
        "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
    ],
    "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,
    "allow-plugins": {
        "pestphp/pest-plugin": true,
        "php-http/discovery": true
    }
},
"minimum-stability": "stable",
"prefer-stable": true

}

here is the original version of the required list

   "require": {
    "asm89/stack-cors": "^1.3.0",
    "brick/math": "^0.8.15",
    "dnoegel/php-xdg-base-dir": "^0.1.1",
    "doctrine/inflector": "^2.0.3",
    "doctrine/instantiator": "^1.3.1",
    "doctrine/lexer": "^1.2.1",
    "dragonmantank/cron-expression": "^2.3.0",
    "egulias/email-validator": "^2.1.18",
    "elic-dev/laravel-site-protection": "^1.1",
    "facade/flare-client-php": "^1.3.2",
    "facade/ignition": "^2.0.7",
    "facade/ignition-contracts": "^1.0.0",
    "fideloper/proxy": "^4.4.0",
    "fruitcake/laravel-cors": "^1.0.6",
    "fzaninotto/faker": "^1.9.1",
    "guzzlehttp/guzzle": "^6.5.5",
    "guzzlehttp/promises": "^1.3.1",
    "guzzlehttp/psr7": "^1.6.1",
    "hamcrest/hamcrest-php": "^2.0.0",
    "laravel/framework": "^7.19.0",
    "laravel/socialite": "^5.2",
    "laravel/tinker": "^2.4.0",
    "laravel/ui": "^2.1.0",
    "laravelcollective/html": "^6.1.2",
    "league/commonmark": "^1.5.1",
    "league/flysystem": "^1.0.69",
    "monolog/monolog": "^2.1.0",
    "myclabs/deep-copy": "^1.10.1",
    "nesbot/carbon": "^2.36.1",
    "nikic/php-parser": "^4.6.0",
    "nunomaduro/collision": "^3.0",
    "opis/closure": "^3.5.5",
    "paypal/rest-api-sdk-php": "1.14",
    "phar-io/manifest": "^1.0.3",
    "phar-io/version": "^2.0.1",
    "phpdocumentor/reflection-common": "^2.2.0",
    "phpdocumentor/reflection-docblock": "^5.1.0",
    "phpdocumentor/type-resolver": "^1.3.0",
    "phpoption/phpoption": "^1.7.4",
    "phpspec/prophecy": "^1.10.3",
    "psr/container": "^1.0.0",
    "psr/event-dispatcher": "^1.0.0",
    "psr/http-message": "^1.0.1",
    "psr/log": "^1.1.3",
    "psr/simple-cache": "^1.0.1",
    "psy/psysh": "^0.10.4",
    "ralouphie/getallheaders": "^3.0.3",
    "ramsey/collection": "^1.0.1",
    "ramsey/uuid": "^4.0.1",
    "sebastian/code-unit-reverse-lookup": "^1.0.1",
    "sebastian/comparator": "^3.0.2",
    "sebastian/diff": "^3.0.2",
    "sebastian/environment": "^4.2.3",
    "sebastian/exporter": "^3.1.2",
    "sebastian/global-state": "^2.0.0",
    "sebastian/object-enumerator": "^3.0.3",
    "sebastian/object-reflector": "^1.1.1",
    "sebastian/recursion-context": "^3.0.0",
    "sebastian/resource-operations": "^2.0.1",
    "sebastian/type": "^1.1.3",
    "sebastian/version": "^2.0.1",
    "sociallydev/spaces-api": "v2",
    "spatie/laravel-permission": "^3.13.0",
    "spatie/laravel-sluggable": "^2.2",
    "square/square": "12.0.0.20210616",
    "swiftmailer/swiftmailer": "^6.2.3",
    "symfony/css-selector": "^5.1.2",
    "symfony/deprecation-contracts": "^2.1.3",
    "symfony/error-handler": "^5.1.2",
    "symfony/event-dispatcher": "^5.1.2",
    "symfony/event-dispatcher-contracts": "^2.1.3",
    "symfony/finder": "^5.1.2",
    "symfony/http-foundation": "^5.1.2",
    "symfony/http-kernel": "^5.1.2",
    "symfony/mime": "^5.1.2",
    "symfony/polyfill-ctype": "^1.17.1",
    "symfony/polyfill-iconv": "^1.17.1",
    "symfony/polyfill-intl-grapheme": "^1.17.1",
    "symfony/polyfill-intl-idn": "^1.17.1",
    "symfony/polyfill-intl-normalizer": "^1.17.1",
    "symfony/polyfill-mbstring": "^1.17.1",
    "symfony/polyfill-php72": "^1.17.0",
    "symfony/polyfill-php73": "^1.17.1",
    "symfony/polyfill-php80": "^1.17.1",
    "symfony/process": "^5.1.2",
    "symfony/routing": "^5.1.2",
    "symfony/service-contracts": "^2.1.3",
    "symfony/string": "^5.1.2",
    "symfony/translation": "^5.1.2",
    "symfony/translation-contracts": "^2.1.3",
    "symfony/var-dumper": "^5.1.2",
    "theseer/tokenizer": "^1.1.3",
    "tijsverkoyen/css-to-inline-styles": "^2.2.2",
    "vemcogroup/laravel-sparkpost-driver": "4.x",
    "vlucas/phpdotenv": "^4.1.7",
    "voku/portable-ascii": "^1.5.2",
    "webmozart/assert": "^1.9.0"
},

2

Answers


  1. Chosen as BEST ANSWER

    with alot of help from @IGP and @miken32 I been able to install the needed packages.

    My final composer.json looks like

        "require": {
        "php": "^8.2",
        "aws/aws-sdk-php": "^3.269",
        "elic-dev/laravel-site-protection": "^1.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.10",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "laravel/ui": "^4.2",
        "laravelcollective/html": "^6.4",
        "league/flysystem-aws-s3-v3": "^3.15",
        "spatie/laravel-permission": "^5.10",
        "spatie/laravel-sluggable": "^3.5"
    },
    

  2. This is not quite the answer to your question but it is a way for you to clean up your composer.json file (and it’s too verbose to really put in a comment nicely formatted).

    As the comments state, a lot of packages get installed as dependencies without needing to be explicitly declared. There is a way for you to know exactly which packages you can safely remove.

    Base composer.json

    This is what the require segments look on a fresh Laravel 7 installation created with the command

    composer create-project --prefer-dist laravel/laravel:^7.0 blog
    
    "name": "laravel/laravel",
    "require": {
        "php": "^7.2.5|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
        "laravel/framework": "^7.29",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.3",
        "phpunit/phpunit": "^8.5.8|^9.3.3"
    },
    

    Extra baggage

    Now, I’ll add two packages that I know are already required, just to make an example

    "name": "laravel/laravel",
    "require": {
        "php": "^7.2.5|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
        "laravel/framework": "^7.29",
        "laravel/tinker": "^2.5",
        "symfony/polyfill-php72": "^1.27", <---
        "symfony/polyfill-php80": "^1.27"  <---
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.3",
        "phpunit/phpunit": "^8.5.8|^9.3.3"
    },
    

    What depends on X package?

    Now how do you know (without prior knowledge) that symfony/polifill-php80 and symfony/polifill-php72 should not be there? A good way is using the command composer why <package>.

    This command will tell why a package is installed. For example, for laravel/tinker this is the result:

    $ composer why laravel/tinker
    
    laravel/laravel - requires laravel/tinker (^2.5)
    

    This tells you that laravel/laravel (the default name for your project (as stated in the name key of your composer.json is requiring laravel/tinker. Nothing else.

    Now look at the result for symfony/polyfill-php72 and symfony/polyfill-php80

    $ composer why symfony/polyfill-php72
    laravel/laravel           -       requires symfony/polyfill-php72 (^1.27)
    symfony/polyfill-intl-idn v1.27.0 requires symfony/polyfill-php72 (^1.10)
    

    this says that aside from it being in the composer.json‘s require, another package installed in your vendor directory are also requiring it, meaning you can safely remove it from the composer.json

    $ composer why symfony/polyfill-php80
    laravel/laravel         -       requires symfony/polyfill-php80 (^1.27)
    nesbot/carbon           2.68.1  requires symfony/polyfill-php80 (^1.16)
    symfony/console         v5.4.24 requires symfony/polyfill-php80 (^1.16)
    symfony/finder          v5.4.21 requires symfony/polyfill-php80 (^1.16)
    symfony/http-foundation v5.4.25 requires symfony/polyfill-php80 (^1.16)
    symfony/http-kernel     v5.4.25 requires symfony/polyfill-php80 (^1.16)
    symfony/mime            v5.4.23 requires symfony/polyfill-php80 (^1.16)
    symfony/process         v5.4.24 requires symfony/polyfill-php80 (^1.16)
    symfony/routing         v5.4.25 requires symfony/polyfill-php80 (^1.16)
    symfony/var-dumper      v5.4.25 requires symfony/polyfill-php80 (^1.16)
    

    this says that aside from it being in the composer.json‘s require, all these other packages installed in your vendor directory are also requiring it, meaning you can safely remove it from the composer.json

    Removing those packages

    2 options:

    • manually removing the line from the composer.json file and then running composer update (which will regenerate the composer.lock file from the modified composer.json
    • running composer remove <package>

    This is my output from trying to clean my composer.json file.

    $ composer remove symfony/polyfill-php80
    ./composer.json has been updated
    Running composer update symfony/polyfill-php80
    Loading composer repositories with package information
    Updating dependencies
    Nothing to modify in lock file
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove
    Package fruitcake/laravel-cors is abandoned, you should avoid using it. No replacement was suggested.
    Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
    Generating optimized autoload files
    74 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    No security vulnerability advisories found
    Removal failed, symfony/polyfill-php80 is still present, it may be required by another package. See `composer why symfony/polyfill-php80`.
    

    The lines that are important here:

    • ./composer.json has been updated (it removed the dependency from your require array)
    • Nothing to modify in lock file (this didn’t change your dependencies)
    • Removal failed, symfony/polyfill-php80 is still present, it may be required by another package. See composer why symfony/polyfill-php80. (this is exactly what I was talking about: the dependency is already required by something else, so it being in your composer.json only clutters it for no reason.

    … And basically you have the long task ahead of you of cleaning up your composer.json file from most of those packages.

    Also whenever you’re unsure about what a composer command will do, you can append --dry-run as an option. This will make the command just show the output without actually doing any changes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search