Symfony 2.8 如何将 GuzzleHttp 包含为 Bundle
Symfony 2.8 How to include GuzzleHttp as Bundle
Guzzle 已过时,因此我通过 composer 安装了推荐的替代品
"guzzlehttp/guzzle": "^6.3",
我查看了供应商目录,其中有我的 guzzlehttp 库:
guzzlehttp,虽然我在删除整个 vendor 目录并再次执行 composer update 后仍然看到旧的 guzzle。
然而,在我的 Appkernel.php 中,我现在想将 guzzlehttp 而不是旧的八点 guzzle 作为一个捆绑包包括在内,我想知道如何做到这一点。
旧语法是这样的:
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
我试过
new GuzzleHttp\GuzzleBundle(),
但是没有找到。我错过了另一个步骤吗?如果有的话是哪一个?
编辑:
原始 composer.json 我想用 guzzleHttp 替换 guzzle 因为这个 guzzle 包似乎被遗弃了:
"require": {
"php": ">=7.0",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"eightpoints/guzzle-bundle": "4.5.*",
"symfony/finder": "^2.8",
"jms/serializer-bundle": "^1.1",
"jms/di-extra-bundle": "~1.3",
"jms/aop-bundle": "~1.1",
"jms/cg": "~1.1",
"psr/cache": "~1.0",
"predis/predis": "1.*",
"snc/redis-bundle": "2.*",
"cache/predis-adapter": "*",
"willdurand/hateoas-bundle": "^1.0",
"hautelook/templated-uri-bundle": "^2.0",
"willdurand/rest-extra-bundle": "^1.0",
"friendsofsymfony/rest-bundle": "^1.7",
"friendsofsymfony/http-cache-bundle": "^1.0",
"avtonom/semaphore-bundle": "dev-master",
"symfony/stopwatch": "*"
},
"require-dev": {
"sensio/generator-bundle": "*",
"phpunit/phpunit": "*",
"phpunit/php-invoker": "*",
"squizlabs/php_codesniffer": "*",
"friendsofphp/php-cs-fixer": "*",
"diablomedia/phpunit-pretty-printer": "*"
},
.....
Guzzle 库不提供任何 Symfony 集成。好像您使用的是旧版本的 EightPointsGuzzleBundle。
不需要 guzzlehttp/guzzle
这只是一个库,而是执行 composer require eightpoints/guzzle-bundle
然后在你的 AppKernel 添加
new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle()
也许你应该将你的包更新到更新的版本。
Guzzle 已过时,因此我通过 composer 安装了推荐的替代品
"guzzlehttp/guzzle": "^6.3",
我查看了供应商目录,其中有我的 guzzlehttp 库: guzzlehttp,虽然我在删除整个 vendor 目录并再次执行 composer update 后仍然看到旧的 guzzle。
然而,在我的 Appkernel.php 中,我现在想将 guzzlehttp 而不是旧的八点 guzzle 作为一个捆绑包包括在内,我想知道如何做到这一点。
旧语法是这样的:
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
我试过
new GuzzleHttp\GuzzleBundle(),
但是没有找到。我错过了另一个步骤吗?如果有的话是哪一个?
编辑:
原始 composer.json 我想用 guzzleHttp 替换 guzzle 因为这个 guzzle 包似乎被遗弃了:
"require": {
"php": ">=7.0",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"eightpoints/guzzle-bundle": "4.5.*",
"symfony/finder": "^2.8",
"jms/serializer-bundle": "^1.1",
"jms/di-extra-bundle": "~1.3",
"jms/aop-bundle": "~1.1",
"jms/cg": "~1.1",
"psr/cache": "~1.0",
"predis/predis": "1.*",
"snc/redis-bundle": "2.*",
"cache/predis-adapter": "*",
"willdurand/hateoas-bundle": "^1.0",
"hautelook/templated-uri-bundle": "^2.0",
"willdurand/rest-extra-bundle": "^1.0",
"friendsofsymfony/rest-bundle": "^1.7",
"friendsofsymfony/http-cache-bundle": "^1.0",
"avtonom/semaphore-bundle": "dev-master",
"symfony/stopwatch": "*"
},
"require-dev": {
"sensio/generator-bundle": "*",
"phpunit/phpunit": "*",
"phpunit/php-invoker": "*",
"squizlabs/php_codesniffer": "*",
"friendsofphp/php-cs-fixer": "*",
"diablomedia/phpunit-pretty-printer": "*"
},
.....
Guzzle 库不提供任何 Symfony 集成。好像您使用的是旧版本的 EightPointsGuzzleBundle。
不需要 guzzlehttp/guzzle
这只是一个库,而是执行 composer require eightpoints/guzzle-bundle
然后在你的 AppKernel 添加
new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle()
也许你应该将你的包更新到更新的版本。