Symfony 4.4 - Swift Mailer 安装失败
Posted
技术标签:
【中文标题】Symfony 4.4 - Swift Mailer 安装失败【英文标题】:Symfony 4.4 - Swift Mailer installation failed 【发布时间】:2022-01-08 18:36:52 【问题描述】:我是 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.0,但您的电脑上有 php 8.x (symfony/web- server-bundle 支持 php 8.x 自 4.4.9 packagist.org/packages/symfony/web-server-bundle#v4.4.9 【参考方案1】:尝试更改 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 已达到其 eol: https://symfony.com/blog/the-end-of-swiftmailer
【讨论】:
正在运行composer update
,我收到此错误消息:问题 1 - 根 composer.json 需要 symfony/web-server-bundle 4.4 -> 可满足 symfony/web-server-bundle[v4.4.0 ]。 - symfony/web-server-bundle v4.4.0 需要 php ^7.1.3 -> 你的 php 版本 (8.0.12) 不满足这个要求。
从 "symfony/web-server-bundle": "4.4" 改为 "symfony/web-server-bundle": "4.4.*",然后运行 composer update
终于成功了!我真的不能感谢你! Grazie tantissimo 先生! :)以上是关于Symfony 4.4 - Swift Mailer 安装失败的主要内容,如果未能解决你的问题,请参考以下文章
从 Symfony 3.4 迁移到 Symfony 4.4 后,自定义投票器无法按预期工作
在 Symfony 4.4 中使用 RedisTagAwareAdapter