Symfony 2.8如何将GuzzleHttp作为Bundle包含在内

时间:2018-02-01 16:48:40

标签: symfony bundle symfony-2.8

Guzzle已经过时,所以我通过作曲家安装了推荐的替代品

"guzzlehttp/guzzle": "^6.3",

我检查了供应商目录,并且有我的guzzlehttp lib: guzzlehttp,虽然我甚至在删除整个供应商目录并再次进行作曲家更新后仍然看到了旧的guzzle。

然而,在我的Appkernel.php中,我想现在包括guzzlehttp而不是旧的八点guzzle作为Bundle,并想知道如何做到这一点。

旧的语法是这样的:

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": "*"
},

...

1 个答案:

答案 0 :(得分:2)

Guzzle lib不提供任何Symfony集成。好像你使用的是旧版的EightPointsGuzzleBundle。

执行guzzlehttp/guzzle然后在 AppKernel 中添加composer require eightpoints/guzzle-bundle而不是仅需要new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle() initializer: assignment-expression { initializer-list } { initializer-list , }

也许您应该将捆绑包更新到更新的版本。