Skip to content

A php implementation of the hippiemedia agent api

Notifications You must be signed in to change notification settings

hippiemedia/php-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hippiemedia/php-agent

What ?

A php library that navigates through HTTP hypermedia APIs.

How ?

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 of Hippiemedia\Agent\Client. You can find a sync or an async example in this repo.

Async support

You can exploit ext-async to make non-blocking calls by using the concurrent-php/http client.

Tests

Run all the tests in parallel:

find tests/unit -name '*.php' | xargs -P0 -n1 php -d auto_prepend_file=vendor/autoload.php

About

A php implementation of the hippiemedia agent api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages