2017 © Pedro Peláez
 

library batch-request-client

Batch request client implementation for php.

image

ideasoft/batch-request-client

Batch request client implementation for php.

  • Monday, January 15, 2018
  • by ideasoft
  • Repository
  • 3 Watchers
  • 23 Stars
  • 452 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 26 % Grown

The README.md

http-batch-client Build Status

http-batch-client allows to combine multiple http requests into a single batch request. This tool is useful for decrease http requests especially for api endpoints., (*1)

About multipart/batch

Http multipart/batch is a format for packaging multiple HTTP requests in a single request. You can read this draft more info: https://tools.ietf.org/id/draft-snell-http-batch-00.html, (*2)

Installing http-batch-client

The easiest way to install http-batch-client is through composer., (*3)

composer require ideasoft/batch-request-client

Important Note:

This is only a client implementation. Your api service should supports batch request. If you are using Symfony 2.8+, you can use https://github.com/IdeasoftLabs/http-batch-bundle for server implementation., (*4)

How to use http-batch-client

You can create a batch request client and send your requests to batch endpoint and use it via client. ```php <?php, (*5)

$client = new \BatchRequest\Client\Client(); $headers = [ "Authorization" => "Bearer TOKEN" ];, (*6)

$requests = [ "users" => new \GuzzleHttp\Psr7\Request("GET", "http://your-api-url/users", ["Authorization" => "Bearer TOKEN"]), "orders" => new \GuzzleHttp\Psr7\Request("GET", "http://your-api-url/orders", ["Authorization" => "Bearer TOKEN"]) ];, (*7)

$data = $client->send("http://your-api-url/batch", $headers, $requests); if ($data->getSubResponses()["users"]->getStatusCode()) { //sub request success for users }, (*8)

The Versions

15/01 2018

dev-master

9999999-dev

Batch request client implementation for php.

  Sources   Download

MIT

The Requires

 

The Development Requires

by IdeasoftLabs

api request batch request

21/12 2016

0.1.1

0.1.1.0

Batch request client implementation for php.

  Sources   Download

MIT

The Requires

 

The Development Requires

by IdeasoftLabs

api request batch request

21/12 2016

0.1

0.1.0.0

Batch request client implementation for php.

  Sources   Download

MIT

The Requires

 

The Development Requires

by IdeasoftLabs

api request batch request