Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions integrations/symfony-bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,49 @@ client:
plugins:
- 'acme_plugin'

If you want to configure your plugin using the bundle configuration, you can
create a class that implements ``PluginConfigurator`` and define ``configurator`` plugins.


.. code-block:: php

final class CustomPluginConfigurator implements PluginConfigurator
{
public static function getConfigTreeBuilder() : TreeBuilder
{
$treeBuilder = new TreeBuilder('custom_plugin');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
->scalarNode('name')
->isRequired()
->cannotBeEmpty()
->end()
->end();

return $treeBuilder;
}

public function create(array $config) : CustomPlugin
{
return new CustomPlugin($config['name']);
}
}

.. code-block:: yaml

// config.yml
httplug:
clients:
acme:
factory: 'httplug.factory.guzzle6'
plugins:
- configurator:
id: 'App\CustomPluginConfigurator'
config:
name: 'foo'

Authentication
--------------

Expand Down
6 changes: 6 additions & 0 deletions integrations/symfony-full-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ This page shows an example of all configuration values provided by the bundle.
plugins:
# Can reference a globally configured plugin service
- 'httplug.plugin.authentication.my_wsse'
# Configure a plugin using a custom PluginConfigurator
- configurator:
id: App\Httplug\Plugin\MyPluginConfigurator
config:
foo: 'bar'
baz: 'qux'
# Can configure a plugin customized for this client
- cache:
cache_pool: 'my_other_pool'
Expand Down