Download the PHP package jmeyering/hal-explorer without Composer
On this page you can find all versions of the php package jmeyering/hal-explorer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jmeyering/hal-explorer
More information about jmeyering/hal-explorer
Files in jmeyering/hal-explorer
Package hal-explorer
Short Description HalExplorer is a php client for exploring HAL Hateoas apis. HalExplorer is able to craft requests and follow links to resource relationships.
License MIT
Informations about the package hal-explorer
hal-explorer: Hateoas Api explorer.
HalExplorer is a php client useful for exploring HAL formatted apis. HalExplorer is able to craft requests and follow links to retreive, create, update and delete resource relationships.
The codebase is fully covered by phpspec and extensively documented.
Install
composer require jmeyering/hal-explorer
Docs
Api Documentation
To generate api documentation use whatever phpdoc generation tool you want
but apigen is included with the composer deps. Just run
vendor/bin/apigen generate
to create the documentation, then point your
browser to public/index.html
to view.
PSR7
The library makes exclusive use of PSR7 messages. Whatever http client is used internally must return PSR7 Message interfaces.
Usage
To use the exploration feature of the library we need to think about our
responses and their included _links
as objects and relationships.
Fetching, Creating, Updating, and Deleting are the primary actions to perform
on a related object. HalExplorer exposes this functionality with the
getRelation
, createRelation
, updateRelation
, patchUpdateRelation
and
deleteRelation
methods.
As expected, these methods map to the GET
, POST
, PUT
, PATCH
and
DELETE
HTTP verbs.
Example
We will use the haltalk api as an endpoint example and guzzlehttp/guzzle for our HTTP Client.