3

I have a Symfony v5.x project.

I want to install it on my Windows PC.

I copied the project folder to wamp/www.

I execute the command composer install.

It throws the following error:

curl error 6 while downloading https://flex.symfony.com/versions.json: Couldn't resolve host name

I found the solution here. The proposed solution is to execute the command:

composer update symfony/flex --no-plugins --no-scripts

It now throws another error:

laminas/laminas-code 4.3.0 requires php ^7.4 || ~8.0.0 -> your php version (7.3.5) does not satisfy that requirement.
    - symfony/proxy-manager-bridge v5.3.0 requires friendsofphp/proxy-manager-lts ^1.0.2 -> satisfiable by friendsofphp/proxy-manager-lts[v1.0.5].
    - friendsofphp/proxy-manager-lts v1.0.5 requires laminas/laminas-code ~3.4.1|^4.0 -> satisfiable by laminas/laminas-code[4.3.0].
    - symfony/proxy-manager-bridge is locked to version v5.3.0 and an update of this package was not requested 

I found a possible solution which proposes to modify composer.json as follows:

"require": {
  "php": "^7.3|^8.0",
}

If I run:

composer dump-autoload
composer update symfony/flex \
  --no-plugins \
  --no-scripts

... I still get the following error:

  • laminas/laminas-code 4.3.0 requires php ^7.4 || ~8.0.0 -> your php version (7.3.5) does not satisfy that requirement` stays.

This is my composer.json:

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "symfony/flex": "^1.1",
        "php": "^7.3|^8.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.2",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.4",
        "doctrine/doctrine-migrations-bundle": "^3.1",
        "doctrine/orm": "^2.9",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^6.1",
        "symfony/asset": "5.3.*",
        "symfony/console": "5.3.*",
        "symfony/dotenv": "5.3.*",
        "symfony/expression-language": "5.3.*",
        "symfony/form": "5.3.*",
        "symfony/framework-bundle": "5.3.*",
        "symfony/google-mailer": "5.3.*",
        "symfony/http-client": "5.3.*",
        "symfony/intl": "5.3.*",
        "symfony/mailer": "5.3.*",
        "symfony/mime": "5.3.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "5.3.*",
        "symfony/process": "5.3.*",
        "symfony/property-access": "5.3.*",
        "symfony/property-info": "5.3.*",
        "symfony/proxy-manager-bridge": "5.3.*",
        "symfony/requirements-checker": "^2.0",
        "symfony/runtime": "5.3.*",
        "symfony/security-bundle": "5.3.*",
        "symfony/serializer": "5.3.*",
        "symfony/string": "5.3.*",
        "symfony/swiftmailer-bundle": "^3.5",
        "symfony/translation": "5.3.*",
        "symfony/twig-bundle": "^5.3",
        "symfony/validator": "5.3.*",
        "symfony/web-link": "5.3.*",
        "symfony/yaml": "5.3.*",
        "tattali/calendar-bundle": "^1.2",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^9.5",
        "symfony/browser-kit": "^5.3",
        "symfony/css-selector": "^5.3",
        "symfony/debug-bundle": "^5.3",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^5.3",
        "symfony/stopwatch": "^5.3",
        "symfony/var-dumper": "^5.3",
        "symfony/web-profiler-bundle": "^5.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true,
            "symfony/runtime": true
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "requirements-checker": "script"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.3.*"
        }
    }
}
Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
achraf bourki
  • 159
  • 2
  • 11

1 Answers1

1

Your PHP version 7.3.5 does not satisfy the requirements of laminas/laminas-code.

Update the PHP version on your system to 7.4 or 8.0 to resolve the composer error.

Alternatively you can "fake" the current PHP version in composer.json.

Use config.platform to override the PHP version detected by composer:

{
  "config": {
    "platform": {
        "php": "7.4.0"
    }
  }
}
Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130