diff --git a/integrations/symfony-bundle.rst b/integrations/symfony-bundle.rst index 02197c2..68ba5b1 100644 --- a/integrations/symfony-bundle.rst +++ b/integrations/symfony-bundle.rst @@ -224,35 +224,26 @@ services are: Plugins ``````` -Clients can have plugins. Generic plugins from ``php-http/plugins`` (e.g. retry -or redirect) can be configured globally. You can tell the client which of those -plugins to use, as well as custom plugins that you configured a service for. +Clients can have plugins that act on the request before it is sent out and/or +on the response before it is returned to the caller. Generic plugins from +``php-http/client-common`` (e.g. retry or redirect) can be configured globally. +You can tell the client which of those plugins to use, as well as specify the +service names of custom plugins that you want to use. Additionally you can configure any of the ``php-http/plugins`` specifically on a client. For some plugins this is the only place where they can be configured. The order in which you specify the plugins **does** matter. -.. code-block:: yaml - - // services.yml - acme_plugin: - class: Acme\Plugin\MyCustomPlugin - arguments: ["%some_parameter%"] +Configure plugins directly on the client: .. code-block:: yaml // config.yml httplug: - plugins: - cache: - cache_pool: 'my_cache_pool' clients: acme: factory: 'httplug.factory.guzzle6' plugins: - - 'acme_plugin' - - 'httplug.plugin.cache' - - 'httplug.plugin.retry' - add_host: host: "http://localhost:8000" - header_defaults: @@ -265,6 +256,40 @@ The order in which you specify the plugins **does** matter. password: 'p4ssw0rd' +Configure the cache plugin globally and use it in the ``acme`` client: + +.. code-block:: yaml + + // config.yml + httplug: + plugins: + cache: + cache_pool: 'my_cache_pool' + clients: + acme: + factory: 'httplug.factory.guzzle6' + plugins: + - 'httplug.plugin.cache' + +Configure a service for your custom plugin and use it in the client: + +.. code-block:: yaml + + // services.yml + acme_plugin: + class: Acme\Plugin\MyCustomPlugin + arguments: ["%some_parameter%"] + +.. code-block:: yaml + + // config.yml + httplug: + clients: + acme: + factory: 'httplug.factory.guzzle6' + plugins: + - 'acme_plugin' + Authentication ``````````````