<NME> usage-batch-request-sending.md
<BEF> ADDFILE
<MSG> Docs about `batchSend()` added

<DFF> @@ -0,0 +1,55 @@
+Batch request sending
+=====================
+
+HTTP Client allows sending multiple requests at once using [[\yii\httpclient\Client::batchSend()]] method:
+
+```php
+use yii\httpclient\Client;
+
+$client = new Client();
+
+$requests = [
+    $client->get('http://domain.com/keep-alive'),
+    $client->post('http://domain.com/notify', ['userId' => 12]),
+];
+$responses = $client->batchSend($requests);
+```
+
+Particular [transport](usage-transports.md) may benefit from this method usage, allowing to increase the performance.
+Among the built-in transports, only [[\yii\httpclient\CurlTransport]] does this. It allows to send requests in parallel,
+which saves the program execution time.
+
+> Note: only some particular transports allows processing requests at `batchSend()` in special way, which provides some
+  benefit. By default transport just sends them one by one without any error or warning thrown. Make sure you have
+  configured correct transport for the client, if you wish to achieve performance boost.
+
+`batchSend()` method returns the array of the responses, which keys correspond the ones from array of requests.
+This allows you to process particular request response in easy way:
+
+```php
+use yii\httpclient\Client;
+
+$client = new Client();
+
+$requests = [
+    'news' => $client->get('http://domain.com/news'),
+    'friends' => $client->get('http://domain.com/user/friends', ['userId' => 12]),
+    'newComment' => $client->post('http://domain.com/user/comments', ['userId' => 12, 'content' => 'New comment']),
+];
+$responses = $client->batchSend($requests);
+
+// result of `GET http://domain.com/news` :
+if ($responses['news']->isOk) {
+    echo $responses['news']->content;
+}
+
+// result of `GET http://domain.com/user/friends` :
+if ($responses['friends']->isOk) {
+    echo $responses['friends']->content;
+}
+
+// result of `POST http://domain.com/user/comments` :
+if ($responses['newComment']->isOk) {
+    echo "Comment has been added successfully";
+}
+```

{'commit': 'diff --git a/Client.php b/Client.php\nindex 3cdcd03..5ee75ec 100644\n--- a/Client.php\n+++ b/Client.php\n@@ -215,6 +215,20 @@ class Client extends Component\n \n     /**\n      * Performs multiple HTTP requests in parallel.\n+     * This method accepts an array of the [[Request]] objects and returns an array of the  [[Response]] objects.\n+     * Keys of the response array correspond the ones from request array.\n+     *\n+     * ```php\n+     * $client = new Client();\n+     * $requests = [\n+     *     \'news\' => $client->get(\'http://domain.com/news\'),\n+     *     \'friends\' => $client->get(\'http://domain.com/user/friends\', [\'userId\' => 12]),\n+     * ];\n+     * $responses = $client->batchSend($requests);\n+     * var_dump($responses[\'news\']->isOk);\n+     * var_dump($responses[\'friends\']->isOk);\n+     * ```\n+     *\n      * @param Request[] $requests requests to perform.\n      * @return Response[] responses list.\n      */\ndiff --git a/Transport.php b/Transport.php\nindex 791edd7..9321ed9 100644\n--- a/Transport.php\n+++ b/Transport.php\n@@ -29,6 +29,8 @@ abstract class Transport extends Component\n     /**\n      * Performs multiple HTTP requests.\n      * Particular transport may benefit from this method, allowing sending requests in parallel.\n+     * This method accepts an array of the [[Request]] objects and returns an array of the  [[Response]] objects.\n+     * Keys of the response array correspond the ones from request array.\n      * @param Request[] $requests requests to perform.\n      * @return Response[] responses list.\n      */\ndiff --git a/docs/guide/README.md b/docs/guide/README.md\nindex a4e91c8..9b9fd08 100644\n--- a/docs/guide/README.md\n+++ b/docs/guide/README.md\n@@ -17,6 +17,7 @@ Usage\n * [Transports](usage-transports.md)\n * [Request options](usage-request-options.md)\n * [Multi-part content](usage-multi-part-content.md)\n+* [Batch request sending](usage-batch-request-sending.md)\n * [Logging and profiling](usage-logging.md)\n * [Setup Client instance](usage-setup-client-instance.md)\n \ndiff --git a/docs/guide/usage-batch-request-sending.md b/docs/guide/usage-batch-request-sending.md\nnew file mode 100644\nindex 0000000..8d3c85f\n--- /dev/null\n+++ b/docs/guide/usage-batch-request-sending.md\n@@ -0,0 +1,55 @@\n+Batch request sending\n+=====================\n+\n+HTTP Client allows sending multiple requests at once using [[\\yii\\httpclient\\Client::batchSend()]] method:\n+\n+```php\n+use yii\\httpclient\\Client;\n+\n+$client = new Client();\n+\n+$requests = [\n+    $client->get(\'http://domain.com/keep-alive\'),\n+    $client->post(\'http://domain.com/notify\', [\'userId\' => 12]),\n+];\n+$responses = $client->batchSend($requests);\n+```\n+\n+Particular [transport](usage-transports.md) may benefit from this method usage, allowing to increase the performance.\n+Among the built-in transports, only [[\\yii\\httpclient\\CurlTransport]] does this. It allows to send requests in parallel,\n+which saves the program execution time.\n+\n+> Note: only some particular transports allows processing requests at `batchSend()` in special way, which provides some\n+  benefit. By default transport just sends them one by one without any error or warning thrown. Make sure you have\n+  configured correct transport for the client, if you wish to achieve performance boost.\n+\n+`batchSend()` method returns the array of the responses, which keys correspond the ones from array of requests.\n+This allows you to process particular request response in easy way:\n+\n+```php\n+use yii\\httpclient\\Client;\n+\n+$client = new Client();\n+\n+$requests = [\n+    \'news\' => $client->get(\'http://domain.com/news\'),\n+    \'friends\' => $client->get(\'http://domain.com/user/friends\', [\'userId\' => 12]),\n+    \'newComment\' => $client->post(\'http://domain.com/user/comments\', [\'userId\' => 12, \'content\' => \'New comment\']),\n+];\n+$responses = $client->batchSend($requests);\n+\n+// result of `GET http://domain.com/news` :\n+if ($responses[\'news\']->isOk) {\n+    echo $responses[\'news\']->content;\n+}\n+\n+// result of `GET http://domain.com/user/friends` :\n+if ($responses[\'friends\']->isOk) {\n+    echo $responses[\'friends\']->content;\n+}\n+\n+// result of `POST http://domain.com/user/comments` :\n+if ($responses[\'newComment\']->isOk) {\n+    echo "Comment has been added successfully";\n+}\n+```\n', 'commit_subject': 'Docs about `batchSend()` added', 'repo_name': 'yiisoft/yii2-httpclient', 'committer': {'name': 'Klimov Paul', 'email': '1fbb7a623e32dc7facb6378c69d5730a3ea8d198@gmail.com', 'time_sec': '1441014321', 'tz_offset': '180', 'date': {'seconds': '1441014321'}}, 'commit_tree': '70235033799eec02a0312455692ba619fe5ba9dc', 'commit_message': 'Docs about `batchSend()` added\n', 'language_name': 'PHP', 'license': 'bsd-3-clause', 'hunks': '@@ -0,0 +1,55 @@\n+Batch request sending\n+=====================\n+\n+HTTP Client allows sending multiple requests at once using [[\\yii\\httpclient\\Client::batchSend()]] method:\n+\n+```php\n+use yii\\httpclient\\Client;\n+\n+$client = new Client();\n+\n+$requests = [\n+    $client->get(\'http://domain.com/keep-alive\'),\n+    $client->post(\'http://domain.com/notify\', [\'userId\' => 12]),\n+];\n+$responses = $client->batchSend($requests);\n+```\n+\n+Particular [transport](usage-transports.md) may benefit from this method usage, allowing to increase the performance.\n+Among the built-in transports, only [[\\yii\\httpclient\\CurlTransport]] does this. It allows to send requests in parallel,\n+which saves the program execution time.\n+\n+> Note: only some particular transports allows processing requests at `batchSend()` in special way, which provides some\n+  benefit. By default transport just sends them one by one without any error or warning thrown. Make sure you have\n+  configured correct transport for the client, if you wish to achieve performance boost.\n+\n+`batchSend()` method returns the array of the responses, which keys correspond the ones from array of requests.\n+This allows you to process particular request response in easy way:\n+\n+```php\n+use yii\\httpclient\\Client;\n+\n+$client = new Client();\n+\n+$requests = [\n+    \'news\' => $client->get(\'http://domain.com/news\'),\n+    \'friends\' => $client->get(\'http://domain.com/user/friends\', [\'userId\' => 12]),\n+    \'newComment\' => $client->post(\'http://domain.com/user/comments\', [\'userId\' => 12, \'content\' => \'New comment\']),\n+];\n+$responses = $client->batchSend($requests);\n+\n+// result of `GET http://domain.com/news` :\n+if ($responses[\'news\']->isOk) {\n+    echo $responses[\'news\']->content;\n+}\n+\n+// result of `GET http://domain.com/user/friends` :\n+if ($responses[\'friends\']->isOk) {\n+    echo $responses[\'friends\']->content;\n+}\n+\n+// result of `POST http://domain.com/user/comments` :\n+if ($responses[\'newComment\']->isOk) {\n+    echo "Comment has been added successfully";\n+}\n+```\n', 'addition_count': 55, 'deletion_count': 0, 'src_file': '/dev/null', 'tgt_file': 'b/docs/guide/usage-batch-request-sending.md', 'file_extension': '.md', 'before_file': 'ADDFILE', 'message': 'Docs about `batchSend()` added\n', 'author_name': 'Klimov Paul', 'lang': 'md'}