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 Controller Laravel Package

phpsa/laravel-api-controller

phpsa/laravel-api-controller provides a reusable base controller for building RESTful APIs in Laravel. It simplifies common CRUD endpoints and standardizes JSON responses, reducing boilerplate so you can ship clean, consistent API controllers faster with less repetitive code.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • phpsa/laravel-api-controller is an opinionated base-controller layer that sits on top of Laravel's native controller/router/API-Resource/FormRequest/Policy stack. It fits conventional "resource CRUD" Laravel services with minimal architectural distortion.
  • Poor fit where the team uses action/command classes, DDD-style aggregates, non-Eloquent repositories, or GraphQL-first APIs — the package's value proposition (convention over configuration for REST CRUD) is largely bypassed there.
  • v7.4.0 adds custom auth guard support in the controller and resource layer. This is the first release note that materially changes the fit assessment: previously, multi-guard applications (admin panel + consumer API, tenant-per-guard, Sanctum/Passport split) would have had to fork or hand-roll controllers for guarded resources. Guard-awareness moves the package from "single-guard apps only" to "plausibly viable for multi-guard apps" — but only if guard resolution is explicit and fails closed.

Integration feasibility

  • Low mechanical effort: composer require → publish config → extend the package's base controller → set per-controller/per-resource guard configuration. This is a configuration-and-convention integration, not an architectural one.
  • The feature is inert unless you actually run multiple guards. For single-guard apps, v7.4.0 is a no-op upgrade with no adoption value.
  • Unknowns that gate the effort estimate: whether guard is set via a controller property, a config map, a resource method, or a container binding; whether it is per-action or per-controller; whether it applies to policy/gate resolution, authorize() calls, and resource-level authorization consistently, or only to some paths.

Technical risk

  • Semver is a minor bump (7.3.2 → 7.4.0), described as a feature addition. Nominal breaking-change risk is low, but Laravel packages frequently ship behavior changes in minors; verify the release diff, not just the changelog.
  • Security-sensitive surface. Auth/authorization changes carry asymmetric downside. The specific hazard is a silent fallback: if an unset or misspelled guard resolves to the default guard, requests authenticate as the wrong principal and authorization silently succeeds or fails in the wrong direction — including cross-tenant data exposure.
  • Bus factor. A first-time contributor landing a single PR is a healthy signal for the project but not evidence of a deep maintainer bench. Treat this package as a lightly-maintained dependency and isolate it behind an internal base class.
  • Evidence gap. There is no prior assessment and no data beyond the release note. Every claim about guard behavior should be treated as a hypothesis to be verified against source and tests before adoption.

Key questions

  1. How is the guard specified — controller property, config file map, resource method, or container binding? Is it per-action or per-controller?
  2. What happens when no guard is configured — explicit default guard, Auth::guard(null), or exception? Is the fallback fail-closed?
  3. Does custom guard support cover policy/gate resolution, authorizeResource, form-request authorize(), and API Resource conditional fields (when(), can), or only some of these?
  4. Does the resource layer resolve the guard independently of the controller, and can they diverge silently?
  5. Does it compose correctly with Sanctum/Passport token guards and multi-tenant guard setups?
  6. What is the test coverage for the new path — are there multi-guard integration tests, or only unit-level assertions?
  7. What is the supported Laravel/PHP version matrix for 7.4.0?
  8. Are there any behavioral changes to the default (single-guard) path?

Integration Approach

Stack fit

  • Presumes Laravel with Eloquent, API Resources, FormRequests, and Policies — i.e., an idiomatic Laravel service. Confirm the package's illuminate/* constraints against your pinned Laravel version and PHP runtime before committing.
  • Best value where the API surface is broad and uniform (many near-identical CRUD resources). Low value for small or highly bespoke API surfaces.

Migration path

  • Because this is a greenfield evaluation, do not migrate — pilot. Timebox a spike against one non-critical resource, then one guarded resource in a non-production environment.
  • Pin 7.4.0 explicitly in composer.json; avoid a floating constraint while guard semantics are unverified.
  • Wrap the package's base controller in a thin internal abstract class from day one, so guard configuration and any future fork live in one place you control.

Compatibility

  • Adopt only if you genuinely have ≥2 guards. Otherwise stay on 7.3.x and revisit when the multi-guard scenario appears — there is no operational upside to taking the upgrade for a feature you cannot exercise.
  • If you are already on the package in a single-guard context, upgrading is low-risk hygiene, but validate the default path is unchanged before shipping.

Sequencing

  1. Read the PR diff and confirm guard resolution and fallback semantics (blocks everything else).
  2. Confirm composer/Laravel/PHP compatibility.
  3. Spike: implement one guarded resource in a sandbox branch; assert the correct principal is resolved.
  4. Negative tests first — unset guard, invalid guard name, wrong-guard token. These are the tests that catch the failure mode that matters.
  5. Pilot in staging with realistic multi-guard traffic.
  6. Roll out resource-by-resource; do not convert the whole surface in one PR.
  7. Document the internal convention for specifying guards.

Operational Impact

Maintenance

  • Small dependency footprint and low upgrade churn, but single-maintainer concentration is the dominant ongoing risk. Maintain a pinned version, watch release cadence, and keep the internal wrapper thin enough that removing the package is a contained refactor.
  • Every future upgrade touching auth must be re-reviewed as a security change, not a routine bump.

Support

  • Developers must learn one convention (how to declare a guard on a controller/resource). Once documented, ongoing support load is near zero.
  • Expect the first support question to be "why is this endpoint authorizing as the wrong user?" — the internal docs should state the fallback behavior explicitly so triage is fast.

Scaling

  • Controller-layer package; runtime overhead is negligible relative to database and serialization costs. Guard resolution is per-request — confirm it is not re-resolving the guard per action or per resource field, which would be a small but avoidable cost on hot endpoints.
  • Scales organizationally only if the convention is enforced; without a documented standard, teams will drift toward hand-rolled controllers and the package's consistency benefit erodes.

Failure modes

  • Silent default-guard fallback — highest severity. Wrong principal resolves, authorization passes, cross-tenant data is exposed. Mitigate with explicit-guard-required convention plus negative tests.
  • Guard divergence between controller and resource — authorization says yes on the controller path but the resource serializes fields for a different principal.
  • Token-guard mismatch with Sanctum/Passport — token parsed under one guard, policy evaluated under another.
  • Test/production drift — the suite runs single-guard and passes; production runs multi-guard and behaves differently.
  • Abandonment — maintainer goes quiet and a future Laravel major forces a fork.

Ramp-up

  • Roughly half a day for a mid-level Laravel developer to become productive with the base-controller conventions; the guard feature itself is a small delta on top.
  • Budget an additional focused security review (a few hours of senior time) before the first guarded resource reaches production. That review is the actual cost of this release, not the upgrade.
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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource