symfony4swiftmailerfailed-installation

Symfony 4.4 - Swift Mailer installation failed


I'm a beginner in Symfony and would like to know how to deal with the following installation issue: I'm using Symfony 4.4 and trying to install Swift Mailer. Following the documentation on this link, when I ran the following command composer require symfony/swiftmailer-bundle , I got this error message:

Your requirements could not be resolved to an installable set of packages.

Problem 1

  • symfony/web-server-bundle is locked to version v4.4.0 and an update of this package was not requested.
  • symfony/web-server-bundle v4.4.0 requires php ^7.1.3 -> your php version (8.0.12) does not satisfy that requirement.

Problem 2

  • laminas/laminas-code 3.4.1 requires php ^7.1 -> your php version (8.0.12) does not satisfy that requirement.
  • symfony/proxy-manager-bridge v4.4.34 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[3.4.1].
  • symfony/proxy-manager-bridge is locked to version v4.4.34 and an update of this package was not requested.

Any idea how to handle that?

Update:

This is my composer.json file:

{
"type": "project",
"license": "proprietary",
"require": {
    "php": ">=7.4.3",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "composer/package-versions-deprecated": "1.11.99.4",
    "doctrine/annotations": "^1.0",
    "doctrine/doctrine-bundle": "^2.5",
    "doctrine/doctrine-migrations-bundle": "^3.2",
    "doctrine/orm": "^2.10",
    "phpdocumentor/reflection-docblock": "^5.3",
    "sensio/framework-extra-bundle": "^5.1",
    "symfony/asset": "4.4.*",
    "symfony/console": "4.4.*",
    "symfony/dotenv": "4.4.*",
    "symfony/expression-language": "4.4.*",
    "symfony/flex": "^1.3.1",
    "symfony/form": "4.4.*",
    "symfony/framework-bundle": "4.4.*",
    "symfony/http-client": "4.4.*",
    "symfony/intl": "4.4.*",
    "symfony/mailer": "4.4.*",
    "symfony/monolog-bundle": "^3.1",
    "symfony/process": "4.4.*",
    "symfony/property-access": "4.4.*",
    "symfony/property-info": "4.4.*",
    "symfony/proxy-manager-bridge": "4.4.*",
    "symfony/security-bundle": "4.4.*",
    "symfony/serializer": "4.4.*",
    "symfony/translation": "4.4.*",
    "symfony/twig-bundle": "4.4.*",
    "symfony/validator": "4.4.*",
    "symfony/web-link": "4.4.*",
    "symfony/web-server-bundle": "4.4",
    "symfony/yaml": "4.4.*",
    "twig/extra-bundle": "^2.12|^3.0",
    "twig/twig": "^2.12|^3.0"
},
"require-dev": {
    "phpunit/phpunit": "^9.5",
    "symfony/browser-kit": "4.4.*",
    "symfony/css-selector": "4.4.*",
    "symfony/debug-bundle": "4.4.*",
    "symfony/maker-bundle": "^1.0",
    "symfony/phpunit-bridge": "^5.3",
    "symfony/stopwatch": "4.4.*",
    "symfony/web-profiler-bundle": "4.4.*"
},
"config": {
    "preferred-install": {
        "*": "dist"
    },
    "sort-packages": true
},
"autoload": {
    "psr-4": {
        "App\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "App\\Tests\\": "tests/"
    }
},
"replace": {
    "paragonie/random_compat": "2.*",
    "symfony/polyfill-ctype": "*",
    "symfony/polyfill-iconv": "*",
    "symfony/polyfill-php71": "*",
    "symfony/polyfill-php70": "*",
    "symfony/polyfill-php56": "*"
},
"scripts": {
    "auto-scripts": {
        "cache:clear": "symfony-cmd",
        "assets:install %PUBLIC_DIR%": "symfony-cmd"
    },
    "post-install-cmd": [
        "@auto-scripts"
    ],
    "post-update-cmd": [
        "@auto-scripts"
    ]
},
"conflict": {
    "symfony/symfony": "*"
},
"extra": {
    "symfony": {
        "allow-contrib": false,
        "require": "4.4.*"
    }
}

}


Solution

  • Try changing composer.json

    From:

    "symfony/web-server-bundle": "4.4",
    

    To:

    "symfony/web-server-bundle": "4.4.*",
    

    Then try running:

    composer update
    

    In order to get the latest versions of the dependencies and to update the composer.lock file: https://getcomposer.org/doc/03-cli.md#update-u,

    then:

    composer require symfony/swiftmailer-bundle
    

    I recommend that you change from swiftmailer to symfony mailer (https://symfony.com/doc/4.4/mailer.html) because swiftmailer has reached its eol: https://symfony.com/blog/the-end-of-swiftmailer