-
Notifications
You must be signed in to change notification settings - Fork 56
Bundle config reference #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
bb5ddef
32f03f9
a798ec3
3e21f1d
62d4448
f2e4f28
fe4a041
54e204c
2f6d9c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,44 @@ Web Debug Toolbar | |
|
||
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. | ||
|
||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would move the topic of auto discovery to the end of the debug toolbar section, with a heading one level below web debug toolbar, to make it more clear this is about an edge case. and i would mention in the intro of this subsection that explicit DI is preferred. |
||
|
||
.. code-block:: yaml | ||
|
||
httplug: | ||
clients: | ||
my_guzzle5: | ||
factory: 'httplug.factory.guzzle5' | ||
discovery: | ||
client: 'httplug.clients.my_guzzle5' | ||
async_client: 'auto' | ||
|
||
The debug info for normal HTTP clients are enabled by default but not for async clients. You can turn all debug info off for auto discovered clients by setting the value to ``false``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets try to make this more readable: 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 You can turn off all interaction of the bundle with auto discovery by setting the value of |
||
|
||
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. | ||
|
||
.. image:: /assets/img/symfony-profiler/dashboard.png | ||
:width: 200px | ||
:align: left | ||
|
||
.. image:: /assets/img/symfony-profiler/request-stack.png | ||
:width: 200px | ||
:align: left | ||
|
||
.. image:: /assets/img/symfony-profiler/error-plugin-failure.png | ||
:width: 200px | ||
:align: left | ||
|
||
|clearfloat| | ||
|
||
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. | ||
|
||
.. code-block:: yaml | ||
|
||
httplug: | ||
toolbar: | ||
captured_body_length: 1000 # Capture the first 1000 chars of the HTTP body | ||
|
||
Discovery of Factory Classes | ||
```````````````````````````` | ||
|
||
|
@@ -157,6 +195,23 @@ You can configure a client with authentication. Valid authentication types are ` | |
factory: 'httplug.factory.guzzle6' | ||
plugins: ['httplug.plugin.authentication.my_wsse'] | ||
|
||
Special HTTP clients | ||
```````````````````` | ||
|
||
If you want to use the ``FlexibleHttpClient`` or ``HttpMethodsClient`` from the ``php-http/message`` package you may specify that on the client configuration. | ||
|
||
.. code-block:: yaml | ||
|
||
// config.yml | ||
httplug: | ||
clients: | ||
acme: | ||
factory: 'httplug.factory.guzzle6' | ||
flexible_client: true | ||
|
||
foobar: | ||
factory: 'httplug.factory.guzzle6' | ||
http_methods_client: true | ||
|
||
List of Services | ||
```````````````` | ||
|
@@ -198,3 +253,7 @@ Usage for Reusable Bundles | |
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. | ||
|
||
The only steps they need is ``require`` one of the adapter implementations in their projects ``composer.json`` and instantiating the ``HttplugBundle`` in their kernel. | ||
|
||
.. |clearfloat| raw:: html | ||
|
||
<div style="clear:left"></div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,12 +65,24 @@ This page shows an example of all configuration values provided by the bundle. | |
stopwatch: | ||
enabled: true | ||
stopwatch: 'debug.stopwatch' | ||
|
||
toolbar: | ||
enabled: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be kernel.debug, no? or is it only ever asked for if the debug toolbar itself is enabled? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No. kernel.debug=false will turn off the toolbar.
correct There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, then its fine like this |
||
formatter: null # Defaults to \Http\Message\Formatter\FullHttpMessageFormatter | ||
captured_body_length: 0 | ||
|
||
discovery: | ||
client: 'auto' | ||
async_client: false | ||
|
||
clients: | ||
acme: | ||
factory: 'httplug.factory.guzzle6' | ||
plugins: ['httplug.plugin.authentication.my_wsse', 'httplug.plugin.cache', 'httplug.plugin.retry'] | ||
flexible_client: false | ||
http_methods_client: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a comment that only one of the two can be true for a specific client? |
||
config: | ||
verify: false | ||
timeout: 2 | ||
# more options to the guzzle 6 constructor | ||
# more options to the Guzzle 6 constructor | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ username | |
whitelist | ||
wiki | ||
workflow | ||
profiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the logging is also controlled by a config setting that defaults to kernel.debug, right? we could maybe mention that below, near where we talk about the body capturing configuration