Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.
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
42 changes: 42 additions & 0 deletions docs/cookbook/httplug-bundle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# HTTPlug bundle

If you are using [Symfony](http://symfony.com/)
with the [HTTPlug bundle](http://docs.php-http.org/en/latest/integrations/symfony-bundle.html),
you may want to setup the client to take benefit of the profiling, without have to re-configure all the stuff.

To do it, we have to call `Docker\DockerClient::createFormEnv` factory method from the HTTPlug factory.

First, declare the factory service:

```yaml
services:
httplug.factory.docker:
class: Http\HttplugBundle\Collector\ProfileClientFactory
arguments:
$factory: [ Docker\DockerClient, 'createFromEnv' ]
```

The `ProfileClientFactory` will detect and call the passed `DockerClient` factory method.

Then, declare the client on the HTTPlug bundle configuration:

```yaml
httplug:
plugins:
logger: ~
clients:
docker:
factory: 'httplug.factory.docker'
plugins: ['httplug.plugin.logger']
```

Finally, declare your `Docker\Docker` instance as a service, giving the HTTPlug client wrapper:

```yaml
services:
Docker\Docker:
arguments:
$httpClient: '@httplug.client.docker'
```

And voilà! Just call your `Docker\Docker` service and you will get the same result with profiling and logs.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ problems and advanced usage when using Docker-PHP

* [Running a container](cookbook/container-run.md)
* [Build an image](cookbook/build-image.md)
* [HTTPlug Bundle](cookbook/httplug-bundle.md)