You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: integrations/symfony-bundle.rst
+72Lines changed: 72 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,57 @@ Web Debug Toolbar
56
56
57
57
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.
58
58
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.
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
+
59
110
Discovery of Factory Classes
60
111
````````````````````````````
61
112
@@ -157,6 +208,23 @@ You can configure a client with authentication. Valid authentication types are `
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
160
228
161
229
List of Services
162
230
````````````````
@@ -198,3 +266,7 @@ Usage for Reusable Bundles
198
266
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.
199
267
200
268
The only steps they need is ``require`` one of the adapter implementations in their projects ``composer.json`` and instantiating the ``HttplugBundle`` in their kernel.
0 commit comments