phug/event
phug/event provides a lightweight event emitter and dispatcher for the Phug template engine, letting you register listeners and trigger events around parsing, compilation, and rendering. Simple to integrate and framework-agnostic.
Adopt when:
Look elsewhere when:
To executives: This is a small infrastructure dependency, not a product bet. It gives our rendering layer a supported way to be extended and instrumented — the plumbing behind customization, white-labeling, and performance visibility — at effectively zero licensing cost (MIT) and minimal code footprint. The honest caveat: it is a niche package with a single-maintainer profile, so we adopt it only inside our existing template engine choice and wrap it behind our own interface. If it stalls, we replace one adapter, not the product. Treat it as a "keep the extension door open" investment, sized accordingly.
To engineering: It is a priority-ordered event dispatcher bound to the Phug render lifecycle. We use it to attach listeners for instrumentation, cache invalidation, and custom directives instead of forking the engine. Constraint we accept: we pin the version, we own the upgrade testing, and we do not let these events become our application-wide event bus — domain events go through a separate, PSR-14 dispatcher. Success looks like new render-stage behavior shipping as listeners with no core patches.
How can I help you explore Laravel packages today?