Hateoas

A PHP library to support implementing representations for HATEOAS REST web services.

Build Status Scrutinizer Quality Score Latest Stable Version PHP7 ready
Get Started View on GitHub VPS Hosting Download .zip Download .tar.gz
🔗

Hypermedia Links

Add discoverable hypermedia links to your API representations using simple annotations, XML, or YAML configuration.

📦

Embedded Resources

Efficiently embed related resources directly in responses, reducing the number of HTTP requests your clients need to make.

📄

Multiple Formats

Supports HAL+JSON, Atom Links for XML, and custom serializers. Easily extend with your own format implementations.

⚡

Expression Language

Leverage Symfony's ExpressionLanguage component for dynamic URI generation and conditional relation building.

📚

Collection Support

Built-in representations for paginated collections, offset-based pagination, and Pagerfanta integration.

🔌

Symfony Integration

First-class Symfony support through the BazingaHateoasBundle. Works seamlessly with JMS Serializer.

Quick Start

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');
Read the Documentation
📖 Recommended read: Transfer files by SSH