@@ -98,6 +98,10 @@ Listing all available commands is out of scope here, please refer to the
9898[ Remote API documentation] ( https://docs.docker.com/reference/api/docker_remote_api_v1.15/ )
9999or the [ class outline] ( src/Client.php ) .
100100
101+ Each of these commands supports async operation and either * resolves* with its * results*
102+ or * rejects* with an ` Exception ` .
103+ Please see the following section about [ promises] ( #promises ) for more details.
104+
101105#### Promises
102106
103107Sending requests is async (non-blocking), so you can actually send multiple requests in parallel.
@@ -115,6 +119,47 @@ $client->version()->then(
115119});
116120```
117121
122+ If this looks strange to you, you can also use the more traditional [ blocking API] ( #blocking ) .
123+
124+ #### Blocking
125+
126+ As stated above, this library provides you a powerful, async API by default.
127+
128+ If, however, you want to integrate this into your traditional, blocking environment,
129+ you should look into also using [ clue/block-react] ( https://github.com/clue/php-block-react ) .
130+
131+ The resulting blocking code could look something like this:
132+
133+ ``` php
134+ use Clue\React\Block;
135+
136+ $loop = React\EventLoop\Factory::create();
137+ $factory = new Factory($loop);
138+ $client = $factory->createClient();
139+
140+ $promise = $client->imageInspect('busybox');
141+
142+ try {
143+ $results = Block\await($promise, $loop);
144+ // resporesults successfully received
145+ } catch (Exception $e) {
146+ // an error occured while performing the request
147+ }
148+ ```
149+
150+ Similarly, you can also process multiple commands concurrently and await an array of results:
151+
152+ ``` php
153+ $promises = array(
154+ $client->imageInspect('busybox'),
155+ $client->imageInspect('ubuntu'),
156+ );
157+
158+ $inspections = Block\awaitAll($promises, $loop);
159+ ```
160+
161+ Please refer to [ clue/block-react] ( https://github.com/clue/php-block-react#readme ) for more details.
162+
118163#### TAR streaming
119164
120165The following API endpoints resolve with a string in the [ TAR file format] ( https://en.wikipedia.org/wiki/Tar_%28computing%29 ) :
0 commit comments