A php library that navigates through HTTP hypermedia APIs.
composer config repositories.hippiemedia/agent vcs https://github.com/hippiemedia/php-agent/
composer require 'hippiemedia/agent'
$agent = (new Agent($client, ['authorization' => getenv('TOKEN')], new HalJson(new HalForms), new HalForms, new SirenJson))
->preferring('application/vnd.siren+json');
$host = getenv('HOST');
$entrypoint = $agent->follow("$host/api");
echo $entrypoint;
echo $entrypoint->operation('subscribe')->submit(Body::http_build_query(['some' => 'value']));
Note:
$client
must be an implementation ofHippiemedia\Agent\Client
. You can find a sync or an async example in this repo.
You can exploit ext-async
to make non-blocking calls by using the concurrent-php/http client.
Run all the tests in parallel:
find tests/unit -name '*.php' | xargs -P0 -n1 php -d auto_prepend_file=vendor/autoload.php