$ show blongden/hal
This repository is a PHP library for creating and parsing HAL (Hypertext Application Language) documents in JSON and XML formats. It provides a fluent API to build HAL resources with links, embedded resources, and data, and render them to HAL+JSON or HAL+XML. The library also includes factories to parse HAL documents back into PHP objects. The architecture centers around the Hal class as the main resource representation, with separate renderers for JSON and XML, and link/resource containers. Key entry points are the Hal constructor, static fromJson/fromXml methods, and rendering methods asJson/asXml. The library has no external dependencies beyond PSR Link and PHP 8.2+, and is actively maintained with CI testing across multiple PHP versions.
The LLM identified 2 files worth highlighting for reuse:
A simple, immutable value object representing a HAL link with URI and attributes. Implements __toString to return the URI. Decoupled from library internals, demonstrating clean separation of concerns and reusable pattern for link representation.
Extends ArrayObject to manage HAL links with CURIE resolution capability. The get method resolves CURIE relations by checking against defined curie links. Shows specialized collection pattern with domain-specific logic (CURIE expansion) while maintaining array-like usability.