Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Api Handler Laravel Package

betalabs/laravel-api-handler

betalabs/laravel-api-handler is a Laravel package for building consistent JSON APIs, centralizing response formatting and exception handling so controllers stay clean and endpoints return predictable, standardized results.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package is an HTTP-to-Eloquent translation layer: it parses request query parameters (_fields, _with, filters, sort, pagination, fulltext search) and shapes an API envelope with meta/counts. It introduces no persistence, queue, or infrastructure footprint beyond the request path.
  • It sits naturally in a Laravel controller/resource pattern, so it is a shallow dependency with a small blast radius — confined to the endpoints that opt into the parser.
  • The provider is registered manually, which is an explicit, auditable boot-time wiring step rather than magic auto-discovery.

Integration feasibility

  • Supported band is PHP ^8.2 and Laravel ^10 || ^11 || ^12 (CI target: PHP 8.5, Laravel 12). This is a modern, narrow window — feasible only if the consuming application has already completed its runtime modernization.
  • Composer constraints are the real gate: an app on PHP 8.1 or Laravel ≤9 cannot install v5 and must remain on the 4.x line.
  • Test tooling (PHPUnit 10.5/11, Testbench 8–10) matters only inside the package repo, not for consumers.

Technical risk

  • Provenance and bus factor. v5.0.0 is cut from a fix branch on top of the v4.0.2 tag, and the release notes state the old master (2023) is being left behind. That is a recovery signal, not a stability signal — it suggests a very small maintainer team and a repository that was dormant. No security policy, LTS commitment, or support window is documented.
  • The fixes themselves are evidence of prior production-grade defects. The 4.x line could terminate a request with die() and a 200 on an unsupported polymorphic _with, emit extra bindings in CountMetaProvider causing MySQL HY093, and throw TypeError on native fulltext without _fields. Teams currently on 4.x may be serving incorrect status codes and silently broken counts today. This is the strongest argument for upgrading, independent of the version bump.
  • HTTP contract change. _with on an unsupported relation now returns 400 ApiHandlerException instead of a 200 with body text. This is correct behavior, but it is an observable API contract change for any client that tolerated the old response, and it will surface in monitoring as a new 4xx class.
  • Newness of the test suite. 58 tests, 99.7% line / 100% method coverage, running on PR, is a genuine improvement — but coverage of newly written tests provides no historical regression evidence, and it replaces a suite that had stopped running. There is no stated evidence of a matrix across PHP 8.2–8.5, Laravel 10–12, and multiple database engines, or of static analysis.
  • Target-version skew. CI targeting PHP 8.5/Laravel 12 is ahead of most production baselines; the supported range is what matters, but verify 8.2/8.3 and Laravel 10 actually pass in CI rather than being nominally allowed.
  • Security surface. Query-parameter-driven relation and column exposure (_with, _fields, filters) is the classic over-posting/data-leak vector if the package does not enforce allowlists. The release notes do not state whether allowlisting is built in or left to the consumer.

Key questions

  • License, security disclosure process, and named maintainer coverage?
  • Is the 4.x line still receiving patches, and for how long?
  • Does the package ship relation/column allowlists, or must every consumer implement them?
  • Is native fulltext MySQL-specific, and what is the supported database matrix?
  • Does CI run the full PHP × Laravel × database matrix, and is there static analysis?
  • Is there a documented 4.x → 5.x upgrade guide beyond the breaking-change summary?
  • Who owns this internally, and what is the fallback if upstream goes dormant again?

Integration Approach

Stack fit

  • Suitable for any Laravel 10–12 JSON API backend using Eloquent. It is request-path only — no workers, cron, migrations, or storage — so it does not interact with deployment topology.
  • The one manual step (provider registration) should live in the application's provider config, not scattered across feature modules.

Migration path

  • The package upgrade is a consequence of a platform upgrade, not an independent task. Treat v5.0.0 as a forcing function: inventory endpoints, upgrade PHP/Laravel, then bump the package.
  • If the application is below PHP 8.2 or Laravel 10, the correct decision is to pin 4.x and defer — but log it as debt, given the 4.x defect set described above.
  • Because the dependency is shallow, a strangler-style fallback is viable: keep the parser on the endpoints that need it and hand-write others if upstream stalls.

Compatibility

  • Watch for conflicts with other packages still constraining Laravel to 9 or lower; resolve those first or the illuminate/* constraint will not resolve.
  • Pin an exact version in composer.lock, and confirm the app's own CI covers PHP 8.2/8.3 — not just the 8.5 the upstream targets.

Sequencing

  1. Inventory routes and controllers that invoke the parser; establish blast radius.
  2. Add characterization tests capturing current responses: envelopes, pagination meta, counts (including GROUP BY), nested _fields/_with, fulltext, and the unsupported-relation case.
  3. Upgrade PHP and Laravel in a branch; verify the app suite green before touching this package.
  4. Bump to v5.0.0 and re-run the characterization suite; diff responses explicitly.
  5. Update client-facing documentation and SDKs to describe 400 on unsupported relations.
  6. Canary one low-traffic endpoint, then roll out; notify API consumers of the status-code change.

Operational Impact

Maintenance

  • Very small code surface, so forking or vendoring is cheap insurance if upstream goes quiet again.
  • Pin the version, enable dependency-bot PRs, and re-evaluate upstream activity quarterly. The 2023→2025 dormancy pattern is the single largest maintenance risk.

Support

  • Expect README-level, community-only support with no SLA. Documentation now covers requirements, install (including manual provider registration), and how to run tests — a real improvement over 4.x.
  • The release notes are written in Portuguese; confirm the engineering team can absorb Portuguese-language docs, or budget a short internal translation/summary.

Scaling

  • Throughput cost is entirely a function of client-supplied parameters, not package internals. The main levers: cap _fields/_with nesting depth, restrict relations and sortable columns to allowlists, bound page size, and require indexes on filterable/sortable columns.
  • Count/meta queries add a second round trip per request (and can carry GROUP BY); cache or make them opt-in on high-traffic list endpoints.
  • native fulltext depends on database FULLTEXT indexes — profile before enabling on large tables.

Failure modes

  • Unsupported polymorphic relation now fails fast with 400 ApiHandlerException — monitorable and correct, but it may break clients that relied on the old 200.
  • The 4.x die()-with-200 behavior meant errors previously looked like successes; any dashboards or alerts tuned to that will need re-baselining, and the new 4xx spike at rollout should be expected, not alarming.
  • HY093 binding and TypeError classes are addressed; verify against the app's actual database engine and fulltext configuration rather than assuming parity.

Ramp-up

  • A Laravel-fluent developer is productive in roughly half a day; full fluency with nested _with/_fields, filter semantics, envelope/meta shape, and fulltext modes takes about two to three days including edge-case debugging.
  • Budget additional time for the consumer-facing contract work — documenting the parameters and the new 400 semantics — since that is where most integration friction will land.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log