Download the PHP package aeq/hal without Composer
On this page you can find all versions of the php package aeq/hal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hal
PHP HAL (Hypertext Application Language) Explorer
This library provides a full featured API to discover a HAL (Hypertext Application Language) API via an expressive interface.
Features
- GuzzleHttp as default HTTP Client
- integrate custom HTTP clients easily
- human readable API
- Shipped with a simple default serializer for JSON responses
- Possibility to integrate custom serializers
- Fully tested
- Used in production projects
Usage
1. Initiate the Explorer
If you want to use the the build in "GuzzleClientAdapter" you have to require guzzlehttp/guzzle manually in your composer project since guzzle is only suggested.
2. Request your API
3. Explore the response
4. Discover your API
The result of following a link is that the resolved resource is appended to the parent „$resource“ object („_embedded“). This allows you to access the linked resource without resolving the link again:
Custom HTTP Clients
Create a new class implementing the "ClientAdapterInterface" and return the response as PSR-7.
Set the custom client adapter to your explorer before using it.
Custom Serializers
Create a new class implementing the "SerializerInterface" and return the response.
Set the custom serializer to your explorer before using it.
Events
This library offers you some events to listen on. To use the event system you have to add the "EventManager" to your Explorer before using it.
To listen on a specific event you have to implement a Listener. A Listener is a PHP object with a public method "handle". As parameter your will get the triggered Event object.
PostClientRequestEvent
This event is called on each executed request (after following a link or using the "request" method) and contains the complete PSR-7 response.