Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PHP
  3. Hateoas

Hateoas

NOASSERTIONPHP3.14.0

A PHP library for adding HATEOAS hypermedia links and embedded resources to REST API representations.

Visit WebsiteGitHubGitHub
1.0k stars120 forks0 contributors

What is Hateoas?

Hateoas is a PHP library that helps developers build HATEOAS-compliant REST APIs by automatically adding hypermedia links and embedded resources to JSON and XML representations. It integrates with JMS Serializer and supports standards like HAL and Atom Links, making APIs more discoverable and self-describing. The library solves the problem of manually managing link generation and resource embedding in API responses.

Target Audience

PHP developers building RESTful web services that need to implement hypermedia controls for API discoverability, especially those using JMS Serializer and frameworks like Symfony or Silex.

Value Proposition

Developers choose Hateoas because it provides a standardized, expressive way to add HATEOAS features without reinventing the wheel, with built-in support for pagination, URL generation, and multiple serialization formats. Its tight integration with JMS Serializer and extensible architecture make it a robust choice for hypermedia-driven APIs.

Overview

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

Use Cases

Best For

  • Adding self-discovery links like 'self', 'next', 'previous' to REST API responses
  • Embedding related resources (e.g., user's manager) to reduce client round-trips
  • Implementing HAL-compliant JSON or XML outputs for hypermedia APIs
  • Handling paginated collections with navigation metadata in APIs
  • Generating dynamic URIs using Symfony Expression Language or route generators
  • Extending Twig templates with hypermedia link helpers for HTML representations

Not Ideal For

  • Projects using serializers other than JMS Serializer (e.g., Symfony Serializer or custom implementations)
  • Simple REST APIs that don't require hypermedia controls or discoverable links
  • Microservices with minimal dependencies where JMS Serializer and Symfony components add unwanted overhead
  • Teams needing highly custom, non-standard hypermedia formats without the resources to implement custom serializers

Pros & Cons

Pros

JMS Serializer Integration

Seamlessly integrates with JMS Serializer, allowing HATEOAS features to be added directly to serialized objects without extra serialization layers, as shown in the usage examples.

Multiple Hypermedia Formats

Supports HAL (JSON/XML) and Atom Links (XML) out of the box, making it easy to comply with common hypermedia standards for API responses.

Dynamic Expression Language

Uses Symfony's Expression Language to generate URIs and conditionally exclude links, enabling flexible, object-driven link creation as demonstrated in the annotations.

Built-in Collection Support

Provides representations like PaginatedRepresentation and OffsetRepresentation for handling paginated data with navigation links, reducing boilerplate code for common API patterns.

Cons

JMS Serializer Lock-in

Heavily dependent on JMS Serializer; projects using other serialization libraries face significant integration hurdles or cannot use Hateoas without major adjustments.

Configuration Complexity

Requires setup of metadata via annotations, XML, or YAML, along with cache directories and URL generators, which adds initial overhead compared to simpler link-generation approaches.

Version Fragmentation

The README points to separate documentation for versions 1.0, 2.0, and 3.0, indicating potential breaking changes and migration challenges that can confuse users.

Frequently Asked Questions

Quick Stats

Stars1,039
Forks120
Contributors0
Open Issues31
Last commit3 months ago
CreatedSince 2012

Tags

#rest#hal#rest-api#serializer#pagination#hateoas#php#json#xml-serialization#api-design#hypermedia

Built With

d
doctrine/annotations
P
PHP
T
Twig

Links & Resources

Website

Included in

PHP32.5kREST3.9k
Auto-fetched 9 hours ago

Related Projects

FusioFusio

Self-Hosted API Management for Builders

Stars2,086
Forks239
Last commit4 days ago
NegotiationNegotiation

Content Negotiation tools for PHP.

Stars1,421
Forks64
Last commit2 years ago
RestlerRestler

Zero-boilerplate REST API framework for PHP 8+. Auto-generates routes, docs, validation.

Stars1,376
Forks308
Last commit4 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub