leaseweb/secure-controller-bundle
A Symfony bundle that adds declarative security to controllers, letting you enforce authentication and authorization rules with attributes or annotations instead of repetitive boilerplate checks in every action.
@Secure("ROLE_X") annotation on a controller action, compare it to the current token's roles, throw an access-denied if not. That is a few dozen lines of glue code. The "buy" decision is really "borrow," and the honest comparison is borrow 100 lines vs. own an unmaintained dependency. Use this package's size as the benchmark that pushes the decision toward "build/inline" or "use the framework's native feature."Consider it (narrowly):
ROLE_ADMIN?" — no ownership, tenant, or attribute conditions.Look elsewhere:
#[IsGranted], or first-class voters for anything conditional; Laravel Gates/Policies with authorize(), can: middleware, or Gate::authorize(). Same capability, zero added dependency.is_granted('EDIT', $post)), expression language, tenant scoping, or ABAC — annotations of this shape cannot express it, and stretching them produces authorization logic smeared across controllers.To executives (one paragraph): This is a small, MIT-licensed Symfony add-on that does exactly one thing — it lets a developer mark a controller action with a required role and blocks users who lack it. It is not a strategic component. It has 14 GitHub stars, no downstream dependents, and has not been released since March 2016, so it has no security-response process. Recommendation: do not adopt it for new work, and if it is already in a product, fold its removal into the next framework upgrade rather than funding a standalone migration. Direct cost is zero and direct risk is low; the reason to say no is opportunity cost and the absence of a maintenance path, not licensing or capability. Its low opportunity score reflects that it offers no differentiation — the same outcome is a built-in feature of every modern framework. The one genuinely useful thing we can take from it is the pattern itself, which we can reimplement in-house in under a day if we ever need it.
To engineering (one paragraph): Mechanically, it is an annotation reader plus a kernel event listener that maps @Secure("ROLE_X") to a role check on the security token — no domain logic, no persistence. Replacing it is a per-controller refactor that can ship incrementally: enumerate every annotated action, map each role string to an #[IsGranted] attribute (or a voter where the check is conditional), and lock current behavior with integration tests before touching anything, since the annotations are not discoverable by grep. The real cost is the enumeration and test backfill, not the code change. Treat it as reference material for how the listener was wired, not as a runtime dependency worth defending.
How can I help you explore Laravel packages today?