Add discoverable hypermedia links to your API representations using simple annotations, XML, or YAML configuration.
Efficiently embed related resources directly in responses, reducing the number of HTTP requests your clients need to make.
Supports HAL+JSON, Atom Links for XML, and custom serializers. Easily extend with your own format implementations.
Leverage Symfony's ExpressionLanguage component for dynamic URI generation and conditional relation building.
Built-in representations for paginated collections, offset-based pagination, and Pagerfanta integration.
First-class Symfony support through the BazingaHateoasBundle. Works seamlessly with JMS Serializer.
Install via Composer and start building HATEOAS-compliant APIs in minutes.
composer require willdurand/hateoas
use Hateoas\HateoasBuilder;
$hateoas = HateoasBuilder::create()->build();
$user = new User(42, 'Adrien', 'Brault');
$json = $hateoas->serialize($user, 'json');
$xml = $hateoas->serialize($user, 'xml');