runroom-packages/render-event-bundle
A Symfony bundle that dispatches events around response rendering, letting you hook into the render lifecycle to inspect or modify output before it reaches the client. Works with standard event subscribers and integrates with other Runroom packages.
What the package is. Despite being framed here as a "Laravel/PHP package," runroom-packages/render-event-bundle is a Symfony bundle that hooks Twig template rendering and dispatches an event immediately before a template is rendered, so listeners can inspect or mutate the render context. It is a single-purpose, narrow-scope utility: one event, one integration point, plus the standard Symfony bundle plumbing (Bundle class, DI extension, service definitions).
Architecture fit.
composing: / creating: events) or a custom View::composer, which we would build ourselves rather than adopt this bundle.Integration feasibility.
composer require, register the bundle in bundles.php, write a listener. Expect hours, not days, for a proof of concept.Twig\Environment, a custom TemplateNameParser, or an extension. Decoration is the usual approach; it affects whether other bundles that also decorate Twig collide with it.Technical risk.
[READ-ONLY] marker indicating this is a subtree split from a private or larger monorepo. Issues and PRs may not be triaged here at all; the "real" source of truth is elsewhere and invisible to us. We cannot assume the package will track future Symfony/Twig releases.Key questions to answer before adoption.
Stack fit. Green light only for Symfony 5/6/7 + Twig. Yellow for Symfony apps that use Twig but have heavy existing Twig decoration (verify no service decoration collision). Red for Laravel — the functional equivalent there is view composers; do not attempt to bridge.
Migration path.
render() overrides, kernel.controller/kernel.response listeners, and view composers. Each is a candidate for consolidation into this event.Compatibility.
composer.json. Do not float ^x on a package with no dependent ecosystem — we have no signal that patch releases are safe.composer update can't silently break rendering.Environment decorator + one event class). Given the package's size, forking is cheap and removes the upstream-availability risk entirely.Sequencing.
Decision recommendation. If we are on Symfony/Twig and already have scattered pre-render variable injection, adopt a fork or a minimal in-house equivalent rather than depending on the read-only mirror. The concept is worth taking; the supply chain is not worth betting on.
Maintenance.
[READ-ONLY] marker means our issues will not be seen. Do not plan for upstream fixes.Support.
FORK.md explaining why, what we changed, and how to rebase on upstream.Scaling.
{% include %} depth. Listeners must be side-effect-free and in-memory.Failure modes.
Twig\Environment can shadow ours, again failing silently.dev vs prod cache warming; validate in a prod-like environment.Ramp-up.
How can I help you explore Laravel packages today?