Basic usage

use Kiwilan\Steward\Services\Http;

$urls = [
  "http://classify.oclc.org/classify2/Classify?isbn=9782266266284&summary=true",
  "http://openlibrary.org/api/volumes/brief/isbn/9782266266284.json",
  "https://www.googleapis.com/books/v1/volumes?q=isbn:9782266266284",
];

$responses = HttpService::pool($urls)
  ->execute()
;

With identifiers

use Kiwilan\Steward\Services\Http;

$urls = [
  'worldcat' => "http://classify.oclc.org/classify2/Classify?isbn=9782266266284&summary=true",
  'openlibrary' => "http://openlibrary.org/api/volumes/brief/isbn/9782266266284.json",
  'google_book' => "https://www.googleapis.com/books/v1/volumes?q=isbn:9782266266284",
];

$responses = HttpService::pool($urls)
  ->execute()
;

A collection will works too.

$urls = collect([
  'worldcat' => "http://classify.oclc.org/classify2/Classify?isbn=9782266266284&summary=true",
  'openlibrary' => "http://openlibrary.org/api/volumes/brief/isbn/9782266266284.json",
  'google_book' => "https://www.googleapis.com/books/v1/volumes?q=isbn:9782266266284",
]);

Advanced usage

With a class

class MyModel
{
  public function __construct(
    public int $id, // identifier, can be any other field name
    public string $url, // endpoint, can be any other field name
    // ...
  ) {
  }
}
use Kiwilan\Steward\Services\Http;

$models = MyModel::fetchAll(); // return MyModel[]

$responses = HttpService::pool($models)
  ->setModelId('id') // optional, default is `id`
  ->setModelUrl('url') // optional, default is `url`
  ->execute()
;

With Laravel model

class MyModel extends Model
{
  protected $fillable = [
    // `id` is available by default, but if you change it, set it to HttpService options
    'url', // endpoint, can be any other field name
    // ...
  ];
}
use Kiwilan\Steward\Services\Http;

$models = MyModel::all(); // return a collection of MyModel

$responses = HttpService::pool($models)
  ->setModelId('id') // optional, default is `id`
  ->setModelUrl('url') // optional, default is `url`
  ->execute()
;

HttpQuery

TODO