lomkit/laravel-rest-api
lomkit/laravel-rest-api is a Laravel package for quickly building production-ready JSON APIs. Define resources declaratively and get automatic CRUD endpoints, powerful filters, sorting, pagination, relationship includes, validation, authorization, and OpenAPI docs while staying close to Laravel conv...
Version assessed: lomkit/laravel-rest-api v2.23.2 (patch release on the 2.23.x line; prior tag 2.23.1). Release content is a single security advisory reference — GHSA-w87g-c4fx-87gg — plus the auto-generated changelog diff. No feature, deprecation, or configuration notes are included in the release text itself.
Architecture fit: The package's value proposition is declarative API exposure over Eloquent: a Resource class declares fields(), relations(), sorts(), filters(), limits(), aggregates(), and instructions(), and a Controller subclass exposes search and mutate endpoints against it. For a Laravel application where Eloquent models and Policies are already the source of truth, this collapses a large amount of hand-written controller/request/resource boilerplate into configuration. The trade-off is an opinionated, package-owned query contract: reads are POST /{resource}/search with a structured JSON body rather than GET-with-query-params. That is a durable architectural commitment, not an implementation detail — it affects CDN/HTTP caching, gateway routing rules, API documentation tooling, and client SDK generation. It is a good fit for internal/back-office and first-party client APIs; it is a weaker fit for public APIs where GET semantics and cacheability are contractual.
Integration feasibility: High for a team already on Laravel. Integration is composer require, publish the config, define one Resource per model, subclass the controller, register routes. No database changes, no sidecar, no separate service. The realistic effort driver is not installation but authorization mapping: the package surfaces every declared field, filter, sort, relation, and aggregate through a single endpoint, so the security boundary is the union of your Policies plus the completeness of your Resource declarations. That is a reviewable but non-trivial surface, and this release is a direct signal that the surface has had at least one flaw.
Technical risk:
Key questions (to resolve before adoption or before closing this review):
Stack fit: Requires a modern Laravel/PHP baseline (PHP 8.x, Laravel 10/11 era for the 2.x line) and assumes Eloquent + Laravel Policies as the persistence and authorization layers. Compatible with Sanctum/Passport for auth and with standard Laravel middleware for throttling. It does not replace your auth model — it delegates to it — so no identity refactor is implied.
Migration path: Two distinct paths, different risk:
Compatibility: Verify the pinned version against our exact Laravel/PHP versions before anything else. Confirm interaction with any existing query-layer packages (e.g. spatie/laravel-query-builder) — running two query-DSL layers over the same models is a source of confusing authorization gaps and should be avoided. Confirm the package's route registration coexists with existing route groups, middleware stacks, and API versioning prefixes.
Sequencing:
Maintenance: Low steady-state effort but non-zero: the 2.23.x line ships frequently, and this release demonstrates that patches can be security-bearing. Assign an owner for dependency updates and a standing rule that security-tagged releases are applied within the defined SLA (typically 24–72h for internet-facing surfaces).
Support: Failure diagnosis moves one layer down — a malformed or rejected search payload surfaces as a package-level validation error rather than a hand-written controller's response. Support engineers and on-call need the DSL documented and a decoder for common client mistakes (unknown field, undeclared relation, exceeded limit). Without that, routine client errors get escalated as incidents.
Scaling: Three predictable pressure points: (a) includes drive eager-loading but deep or wide relation graphs can still produce large result sets and heavy queries; (b) aggregates execute at request time against production tables and are the most likely source of slow queries — mandate indexes on any field declared sortable or aggregatable; (c) the POST-based search endpoint is not CDN-cacheable, so all read traffic reaches the application tier. Capacity models must assume no edge caching for reads unless a cache layer is added at the application level. Rate limiting on the search endpoint should be treated as mandatory, not optional.
Failure modes:
includes causing database saturation under adversarial or careless clients.Ramp-up: A Laravel-fluent developer is productive on the package in roughly one to two weeks; the learning curve is the DSL and the Resource declaration model, not Laravel. The TPM-side ramp-up is separate and should not be underestimated: the team needs an owned, reviewed inventory of what each Resource exposes, because that inventory — not the framework — is the actual access-control specification.
Recommendation: Apply 2.23.2 immediately as a security patch and treat the advisory text as a required input. Do not treat this release as evidence against the package, but do treat it as evidence that the authorization surface needs an explicit, tested, owned specification before the package is expanded beyond a single pilot Resource.
How can I help you explore Laravel packages today?