expertcoder/before-after-bundle
A Symfony 2/3 bundle that runs code before every action in a controller. Implement ExecuteBeforeInterface on your controller and put logic in executeBefore() to execute automatically before any action method is invoked.
Architecture fit: poor, and mismatched to the stated target stack. Despite being filed under a "Laravel/PHP package" review request, expertcoder/before-after-bundle is a Symfony 2/3 bundle, not a Laravel package. It integrates via AppKernel::registerBundles() and hooks into Symfony\Component\HttpKernel\Event\FilterControllerEvent — both constructs that have no counterpart in Laravel's bootstrap or HTTP kernel. There is no service provider, no facade, no config publish, and no Laravel-compatible autoloading story. From a TPM standpoint, the first decision is not "how do we integrate this" but "is the requested pattern portable at all," and the answer is that only the concept is portable, not the code.
Integration feasibility: low as a dependency; moderate as a design reference. composer require expertcoder/before-after-bundle will almost certainly fail dependency resolution in any modern Laravel application. Laravel 9+ requires symfony/http-kernel ^6.0 (Laravel 11/12 require ^7.0), while this bundle targets Symfony 2/3 and the long-removed FilterControllerEvent. FilterControllerEvent was deprecated in Symfony 4.1 and removed in Symfony 5.0, so even a Symfony shop cannot use this bundle without being pinned to an EOL major. The only realistic path is to reimplement the behavior natively in Laravel — HTTP middleware for cross-cutting before/after logic, controller traits or route middleware for per-controller behavior, and framework events (RouteMatched, RequestHandled, terminable middleware) for the hook points.
Technical risk: high, concentrated in abandonment rather than functionality. The repository is archived, scored 0.02, has 2 stars, 0 dependents, and a maturity level of "readme" — no evidence of a test suite, CI, changelog, or tagged release discipline. The README's own TODO states executeAfter is unimplemented, meaning the package delivers roughly half its name. Archived plus zero dependents means no downstream pressure to fix anything and no community-vetted usage patterns. Adopting the code introduces a permanent fork obligation for a capability that Laravel provides out of the box.
Key questions for the requester:
KernelEvents::CONTROLLER event subscribers, not to this bundle.executeBefore() returns void in the example and gives no documented short-circuit semantics — that ambiguity alone is a blocker for security-adjacent use cases.Stack fit: none for Laravel; legacy-only for Symfony. On Laravel 10–12 / PHP 8.2+, the package cannot be installed and should not be. On Symfony 4+, the bundle is dead code. On Symfony 2.3–3.4, it fits — but those branches have been EOL since 2018 (2.x) and 2021 (3.4), so that fit is not a viable production target.
Migration path: translate the pattern, then retire the dependency. The recommended sequence is to treat this repository as documentation of an idiom rather than an artifact to ship:
terminate() for post-response work); route-level middleware for per-controller scope; Illuminate\Routing\Events\RouteMatched if action-level dispatch is needed.EventSubscriber on KernelEvents::CONTROLLER (before) and KernelEvents::RESPONSE or kernel.terminate (after). This is the direct successor to FilterControllerEvent and is supported on all maintained versions.Compatibility: PHP version constraints in the composer manifest will be pinned to a PHP 5.x/7.0-era range, clashing with PHP 8.x requirements in Laravel and modern Symfony. Laravel's own symfony/* transitive dependencies will conflict directly. There is no path to a clean composer update graph.
Sequencing: discovery spike (1 day) → design of the native equivalent (2–3 days) → implementation with tests (3–5 days) → remove the package from consideration and document the decision. Total effort is small enough that forking the bundle is strictly more expensive than reimplementing the behavior.
Maintenance: Total. Archived status means security patches, PHP 8.x compatibility fixes, and Symfony version bumps will never arrive. Any fork becomes an internal product with an internal owner, and its blast radius spans every controller that implements the interface — a wide, shallow coupling that is easy to forget during refactors.
Support: Effectively zero. A single-author archived repository with two stars and no dependents gives no community backchannel, no issue triage, and no upgrade guidance. Internal engineers unfamiliar with the pattern will search for a package that no longer resolves in Composer and lose time on the dead end.
Scaling: Runtime cost is negligible — one extra method call per action. The scaling concern is architectural: implicit per-controller before hooks create invisible control flow that compounds as the controller count grows, and the absence of an executeAfter implementation forces teams to hand-roll cleanup, telemetry, and transaction commit logic in inconsistent places. A single well-named middleware stack scales far better cognitively than N controllers each implementing an interface.
Failure modes:
implements ExecuteBeforeInterface, the hook simply does not run — no error, no log. For audit or authorization logic this is a correctness and compliance defect, not a nuisance.executeBefore() throws is unspecified; requests may hang or return unhandled 500s.executeAfter exists because of the package name and discover the TODO only after designing around it.Ramp-up: The concept takes minutes to explain — hence the temptation. That low learning curve is precisely the hazard: a trivially graspable but unmaintained pattern can propagate through a controller layer before anyone notices the dependency is archived. Recommendation: reject as a dependency, adopt the pattern natively via Laravel middleware (or Symfony event subscribers), and record the decision so the same request does not resurface at the next package audit.
How can I help you explore Laravel packages today?