我是 Symfony 的初学者,想知道如何处理以下安装问题: 我正在使用 Symfony 4.4 并尝试安装 Swift Mailer。按照此 link 上的文档,当我运行以下命令
composer require symfony/swiftmailer-bundle
时,我收到此错误消息:
您的要求无法解决为一组可安装的 包裹。
问题1
- symfony/web-server-bundle 已锁定到版本 v4.4.0,并且未请求此包的更新。
- symfony/web-server-bundle v4.4.0 需要 php ^7.1.3 -> 你的 php 版本(8.0.12)不满足该要求。
问题2
- laminas/laminas-code 3.4.1 需要 php ^7.1 -> 你的 php 版本 (8.0.12) 不满足该要求。
- symfony/proxy-manager-bridge v4.4.34 需要 Friendsofphp/proxy-manager-lts ^1.0.2 -> 可满足 Friendsofphp/proxy-manager-lts[v1.0.5].
- friendsofphp/proxy-manager-lts v1.0.5 需要 laminas/laminas-code ~3.4.1|^4.0 -> 可满足 laminas/laminas-code[3.4.1]。
- symfony/proxy-manager-bridge 已锁定到版本 v4.4.34,并且未请求更新此软件包。
知道如何处理吗?
更新:
这是我的composer.json 文件:
{
"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.*"
}
}
}
尝试更改composer.json
来自:
"symfony/web-server-bundle": "4.4",
致:
"symfony/web-server-bundle": "4.4.*",
然后尝试运行:
composer update
为了获取最新版本的依赖项并更新composer.lock文件:https://getcomposer.org/doc/03-cli.md#update-u,
然后:
composer require symfony/swiftmailer-bundle
我建议您从 swiftmailer 更改为 symfony mailer (https://symfony.com/doc/4.4/mailer.html),因为 swiftmailer 已达到其使用寿命: https://symfony.com/blog/the-end-of-swiftmailer