Skip to content

Commit 3e88685

Browse files
authored
Merge pull request #118 from Nyholm/bundle-config-reference
Bundle config reference
2 parents b32081d + 2f6d9c2 commit 3e88685

File tree

6 files changed

+86
-1
lines changed

6 files changed

+86
-1
lines changed
464 KB
Loading
Loading
769 KB
Loading

integrations/symfony-bundle.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,57 @@ Web Debug Toolbar
5656

5757
When using a client configured with ``HttplugBundle``, you will get debug information in the web debug toolbar. It will tell you how many request were made and how many of those that were successful or not. It will also show you detailed information about each request.
5858

59+
The web profiler page will show you lots of information about the request and also how different plugins changes the message. See example screen shots below.
60+
61+
.. image:: /assets/img/symfony-profiler/dashboard.png
62+
:width: 200px
63+
:align: left
64+
65+
.. image:: /assets/img/symfony-profiler/request-stack.png
66+
:width: 200px
67+
:align: left
68+
69+
.. image:: /assets/img/symfony-profiler/error-plugin-failure.png
70+
:width: 200px
71+
:align: left
72+
73+
|clearfloat|
74+
75+
The body of the HTTP messages is not captured by default because of performance reasons. Turn this on by changing the ``captured_body_length`` configuration.
76+
77+
.. code-block:: yaml
78+
79+
httplug:
80+
toolbar:
81+
captured_body_length: 1000 # Capture the first 1000 chars of the HTTP body
82+
83+
The toolbar is automatically turned off when ``kernel.debug = false``. You can also disable the toolbar by configuration.
84+
85+
.. code-block:: yaml
86+
87+
httplug:
88+
toolbar: false
89+
90+
You can configure the bundle to show debug information for clients found with discovery. You may also force a specific client to be found when a third party library is using discovery. The configuration below makes sure the client with service id ``httplug.clients.my_guzzle5`` is returned when calling ``HttpClientDiscovery::find()`` . It does also make sure to show debug info for asynchronous clients.
91+
92+
.. note::
93+
94+
Ideally, you would always use dependency injection and never rely on auto discovery to find a client.
95+
96+
.. code-block:: yaml
97+
98+
httplug:
99+
clients:
100+
my_guzzle5:
101+
factory: 'httplug.factory.guzzle5'
102+
discovery:
103+
client: 'httplug.clients.my_guzzle5'
104+
async_client: 'auto'
105+
106+
For normal clients, the auto discovery debug info is enabled by default. For async clients, debug is not enabled by default to avoid errors when using the bundle with a client that can not do async. To get debug information for async clients, set ``discovery.async_client`` to ``'auto'`` or an explicit client.
107+
108+
You can turn off all interaction of the bundle with auto discovery by setting the value of ``discovery.client`` to ``false``.
109+
59110
Discovery of Factory Classes
60111
````````````````````````````
61112

@@ -157,6 +208,23 @@ You can configure a client with authentication. Valid authentication types are `
157208
factory: 'httplug.factory.guzzle6'
158209
plugins: ['httplug.plugin.authentication.my_wsse']
159210
211+
Special HTTP clients
212+
````````````````````
213+
214+
If you want to use the ``FlexibleHttpClient`` or ``HttpMethodsClient`` from the ``php-http/message`` package you may specify that on the client configuration.
215+
216+
.. code-block:: yaml
217+
218+
// config.yml
219+
httplug:
220+
clients:
221+
acme:
222+
factory: 'httplug.factory.guzzle6'
223+
flexible_client: true
224+
225+
foobar:
226+
factory: 'httplug.factory.guzzle6'
227+
http_methods_client: true
160228
161229
List of Services
162230
````````````````
@@ -198,3 +266,7 @@ Usage for Reusable Bundles
198266
Rather than code against specific HTTP clients, you want to use the HTTPlug ``Client`` interface. To avoid building your own infrastructure to define services for the client, simply ``require: php-http/httplug-bundle`` in your bundles ``composer.json``. You SHOULD provide a configuration option to specify the which HTTP client service to use for each of your services. This option should default to ``httplug.client``. This way, the default case needs no additional configuration for your users, but they have the option of using specific clients with each of your services.
199267

200268
The only steps they need is ``require`` one of the adapter implementations in their projects ``composer.json`` and instantiating the ``HttplugBundle`` in their kernel.
269+
270+
.. |clearfloat| raw:: html
271+
272+
<div style="clear:left"></div>

integrations/symfony-full-configuration.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,24 @@ This page shows an example of all configuration values provided by the bundle.
6565
stopwatch:
6666
enabled: true
6767
stopwatch: 'debug.stopwatch'
68+
69+
toolbar:
70+
enabled: true
71+
formatter: null # Defaults to \Http\Message\Formatter\FullHttpMessageFormatter
72+
captured_body_length: 0
73+
74+
discovery:
75+
client: 'auto'
76+
async_client: false
77+
6878
clients:
6979
acme:
7080
factory: 'httplug.factory.guzzle6'
7181
plugins: ['httplug.plugin.authentication.my_wsse', 'httplug.plugin.cache', 'httplug.plugin.retry']
82+
flexible_client: false # Can only be true if http_methods_client is false
83+
http_methods_client: false # Can only be true if flexible_client is false
7284
config:
7385
verify: false
7486
timeout: 2
75-
# more options to the guzzle 6 constructor
87+
# more options to the Guzzle 6 constructor
7688

spelling_word_list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ matchers
1818
multipart
1919
param
2020
params
21+
profiler
2122
Puli
2223
rebase
2324
Semver

0 commit comments

Comments
 (0)