HttplugBundle: ServiceNotFoundException : The "httplug.message_factory" service or alias has been removed...

Q A
Bug? no
New Feature? no
Version Specific version or SHA of a commit

Symfony 4.0.2

I am developing my web application using HTTPLUG after Symfony of PHP frameworks was upgraded from version 3 to version 4.0.2

However, I have an issue about “ServiceNotFoundException” that is as below

The “httplug.message_factory” service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

the source code is that $request = $this->container->get('httplug.message_factory')->createRequest('GET', $url); $response = $this->container->get('httplug.client.twitch')->sendRequest($request);

I have checked some information. could you please give me an advice?

php ./bin/console debug:container

httplug.async_client.default Http\Client\HttpAsyncClient
httplug.auto_discovery.auto_discovered_async alias for “httplug.collector.auto_discovered_async”
httplug.auto_discovery.auto_discovered_client alias for “httplug.collector.auto_discovered_client”
httplug.client Http\Adapter\Guzzle6\Client
httplug.client.amazon Http\Client\Common\PluginClient
httplug.client.app alias for “httplug.client.app.http_methods”
httplug.client.default alias for “httplug.client.app.http_methods”
httplug.client.facebook Http\Client\Common\PluginClient
httplug.client.game Http\Client\Common\PluginClient
httplug.client.game_pc_riotgames_lol Http\Client\Common\PluginClient
httplug.client.instagram Http\Client\Common\PluginClient
httplug.client.kakao Http\Client\Common\PluginClient
httplug.client.linkedin Http\Client\Common\PluginClient
httplug.client.naver Http\Client\Common\PluginClient
httplug.client.twitch Http\Client\Common\PluginClient
httplug.client.youtube Http\Client\Common\PluginClient
httplug.message_factory Http\Message\MessageFactory\GuzzleMessageFactory
httplug.message_factory.default Http\Message\MessageFactory\GuzzleMessageFactory
httplug.plugin.authentication.my_basic Http\Client\Common\Plugin\AuthenticationPlugin
httplug.plugin.authentication.my_basic.auth Http\Message\Authentication\BasicAuth
httplug.plugin.authentication.my_bearer Http\Client\Common\Plugin\AuthenticationPlugin
httplug.plugin.authentication.my_bearer.auth Http\Message\Authentication\Bearer
httplug.plugin.authentication.my_service Http\Client\Common\Plugin\AuthenticationPlugin
httplug.strategy Http\HttplugBundle\Discovery\ConfiguredClientsStrategy
httplug.stream_factory Http\Message\StreamFactory\GuzzleStreamFactory
httplug.stream_factory.default Http\Message\StreamFactory\GuzzleStreamFactory
httplug.uri_factory Http\Message\UriFactory\GuzzleUriFactory
httplug.uri_factory.default Http\Message\UriFactory\GuzzleUriFactory

php ./bin/console debug:container httplug.message_factory

This service is an alias for the service httplug.message_factory.default

Information for Service “httplug.message_factory.default”


Option Value


Service ID httplug.message_factory.default
Class Http\Message\MessageFactory
Tags -
Public yes
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired no
Autoconfigured no
Factory Class Http\Discovery\MessageFactoryDiscovery
Factory Method find


php ./bin/console debug:container httplug.client.twitch

Information for Service “httplug.client.twitch”


Option Value


Service ID httplug.client.twitch
Class Http\Client\Common\PluginClient
Tags -
Public yes
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired no
Autoconfigured no
Factory Service Http\Client\Common\PluginClientFactory
Factory Method createClient


/config/packages/httplug.yaml

httplug: main_alias: client: httplug.client.default message_factory: httplug.message_factory.default uri_factory: httplug.uri_factory.default stream_factory: httplug.stream_factory.default classes: client: ~ message_factory: ~ uri_factory: ~ stream_factory: ~ profiling: enabled: true formatter: null captured_body_length: 1000 discovery: client: ‘auto’ async_client: ‘auto’ clients: twitch: factory: ‘httplug.factory.guzzle6’ flexible_client: false http_methods_client: false config: verify: false timeout: 2

"require": {
    "php": "^7.1.3",
    "doctrine/doctrine-fixtures-bundle": "^3.0",
    "hwi/oauth-bundle": "^0.6.0",
    "php-http/guzzle6-adapter": "^1.1",
    "php-http/httplug-bundle": "^1.8",
    "php-http/httplug-pack": "^1.0",
    "sensio/framework-extra-bundle": "^5.0",
    "sensiolabs/security-checker": "^4.1",
    "symfony/asset": "^4.0",
    "symfony/console": "^4.0",
    "symfony/expression-language": "^4.0",
    "symfony/finder": "^4.0",
    "symfony/flex": "^1.0",
    "symfony/form": "^4.0",
    "symfony/framework-bundle": "^4.0",
    "symfony/lts": "^4@dev",
    "symfony/monolog-bundle": "^3.1",
    "symfony/orm-pack": "^1.0",
    "symfony/polyfill-apcu": "^1.5",
    "symfony/requirements-checker": "^1.0",
    "symfony/security-bundle": "^4.0",
    "symfony/swiftmailer-bundle": "^3.1",
    "symfony/translation": "^4.0",
    "symfony/validator": "^4.0",
    "symfony/webpack-encore-pack": "^1.0",
    "symfony/yaml": "^4.0",
    "twig/extensions": "^1.5",
    "twig/twig": "^2.4"
},
"require-dev": {
    "symfony/dotenv": "^4.0",
    "symfony/browser-kit": "^4.0",
    "symfony/css-selector": "^4.0",
    "symfony/debug-bundle": "^4.0",
    "symfony/phpunit-bridge": "^4.0",
    "symfony/profiler-pack": "^1.0",
    "friendsofphp/php-cs-fixer": "^2.7"
},

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments