Closed
Description
Can I get some feedback on this approach to configure the plugins?
my_redirect_plugin:
class: Http\Client\Plugin\RedirectPlugin
my_logger_plugin:
class: Http\Client\Plugin\LoggerPlugin
arguments: ["@monolog"]
my_cache_plugin:
class: Http\Client\Plugin\CachePlugin
arguments: ["@cache", "@stream_factory"]
httplug:
clients:
my_guzzle5:
factory: 'httplug.factory.guzzle5'
plugins: ['@my_logger_plugin', '@my_cache_plugin']
config:
defaults:
verify_ssl: false
timeout: 4
acme:
factory: 'httplug.factory.guzzle6'
plugins: ['@my_logger_plugin', '@my_redirect_plugin']
config:
base_uri: 'http://google.se/'
This would allow you to use your own plugins, set the order etc. It would also be easy to inject a JournalPlugin to use internally for the debug toolbar.
We could go with an approach where we name the plugins etc etc but it is a simplier implementation and easier to use (no magic) if we reference them as a service.
Metadata
Metadata
Assignees
Labels
No labels