- What is gointegro/hateoas and what problem does it solve?
- gointegro/hateoas is a Laravel package for building HATEOAS-compliant REST APIs. It wraps Eloquent-backed responses in a hypermedia envelope with links, embedded relationships, sparse fieldsets, and pagination so clients can discover API behavior. It sits between controllers and models, similarly to Laravel API Resources or league/fractal.
- Is gointegro/hateoas compatible with Laravel 10, Laravel 11, and PHP 8.2?
- No. The last release was June 2015 and it targets Laravel 4.x/5.x and PHP 5.x. Installing it on Laravel 10/11 with PHP 8.2 is not viable without a fork; expect Composer constraint edits, PHP 8 syntax fixes, and container or contract updates.
- How do I install gointegro/hateoas?
- On a legacy Laravel 4.x/5.x stack you would install it with Composer as gointegro/hateoas and register its service provider. On a modern stack, Composer constraints will typically block installation, so treat adoption as a vendoring and fork exercise rather than a simple composer require. Confirm Packagist availability and pin the exact version internally.
- Does gointegro/hateoas support both HAL and JSON:API?
- The package advertises HAL and JSON:API-style output, including links, embedded relationships, sparse fieldsets, and pagination. However, the serializer is from the 2015 era and follows the JSON:API draft of that time. Validate media-type handling, document structure, and error semantics against your current clients before relying on it.
- How does gointegro/hateoas compare to Laravel API Resources and league/fractal?
- It competes directly with Laravel API Resources and league/fractal by adding hypermedia links and embedded relationships around Eloquent resources. Native API Resources are maintained with Laravel and are the better default for greenfield projects. Choose gointegro/hateoas only when preserving legacy hypermedia behavior matters more than maintenance cost.
- Can I use gointegro/hateoas in a new Laravel project?
- It is a poor fit for greenfield Laravel 10/11 applications because it is unmaintained and pinned to old framework and PHP versions. A maintained JSON:API library plus Laravel API Resources will deliver the same envelope without the fork burden. Use gointegro/hateoas as a reference blueprint rather than a fresh dependency.
- Why are generated links broken or missing in gointegro/hateoas?
- Link generation depends on named routes resolving correctly and on a conventional Laravel request lifecycle with route model binding. If the API sits behind Dingo or an API gateway, check middleware ordering and route name availability. Verify pagination and content negotiation because both can change the generated links.
- Does gointegro/hateoas handle N+1 queries for included relationships?
- That optimization is not documented, and the serialization path should be treated as something you own. Eager-load relationships explicitly and enforce a maximum include depth to prevent included-relationship explosion. Hypermedia envelopes also inflate payloads roughly 20 to 40 percent, so measure response size and database query counts under load.
- What are the best alternatives to gointegro/hateoas?
- For modern Laravel, use native API Resources with a maintained JSON:API package such as laravel-json-api, or league/fractal if you prefer transformers. These options have current framework support, CI signal, and dependency hygiene. If you must preserve existing consumer contracts, fork gointegro/hateoas and modernize it internally.
- How do I fork and modernize gointegro/hateoas for Laravel 11?
- Vendor the MIT-licensed source, pin it in an internal package registry, and update Composer constraints, PHP 8 syntax, and container contracts for the target Laravel version. Add CI on PHP 8.2+ and snapshot contract tests for link shapes, sparse fieldsets, and included relationships. Roll out resource by resource, starting with a low-traffic read-only endpoint and diffing responses against the incumbent serializer.