slim/twig-view
Twig-View integrates the Twig templating engine with Slim Framework, enabling .twig template rendering in Slim 4 applications. It offers middleware, a configurable Twig environment, extensions, and flexible view rendering for clean, maintainable PHP apps.
twig/twig >= 3.11.1, which is a platform-level constraint worth registering explicitly.ViewInterface implementation that wires Slim's container to a Twig Environment with loader paths, caching, and extension registration. Build is ~150–250 LOC; buy is a maintained, MIT-licensed adapter owned by the Slim org. This package makes "buy" the default and reserves our engineering time for product surface.twig/twig to 3.11.1 to remediate advisory GHSA-6j75-5wfj-gh66. That reframes the maintenance question from "will this package keep shipping features?" to the more useful "does it relay upstream security fixes quickly, and do we have a process to consume them?" The answer to the first appears to be yes; the second is a decision we own.include/echo, this provides an incremental path: keep routing and middleware, swap the view layer, then migrate templates page by page. Patch-level security bumps do not disturb that sequencing.^3.0."Important scoping correction: this is not a Laravel package. It targets Slim Framework 4. In a Laravel codebase the equivalent decision is Blade (default) or rcrowe/twigbridge if Twig is a hard requirement. Note also that this advisory is a Twig issue, not a Slim-View issue — Laravel/Symfony services on Twig need the same 3.11.1 floor applied independently of this package.
Adopt when:
render() returns a Response directly, no manual Emitter plumbing.composer audit in CI, and a lockfile committed per service. A security-advisory-driven release is only valuable if something in your pipeline actually pulls it.Look elsewhere when:
twig/twig below 3.11.1. You'll either be blocked on the security fix or forced into a constraint conflict. Resolve this before committing to the package.Health-signal caveat: the dependents: 0 figure in this dataset is almost certainly a measurement artifact — Twig-View has a meaningful Packagist install base. Validate against Packagist download stats and GitHub activity before treating it as adoption risk. Release velocity remains low (thin adapter, expected), but 3.4.1 demonstrates the maintainers cut a release outside a normal feature cadence specifically to close a security gap — treat that as a positive maintenance signal while still keeping the fork trigger armed.
To executives: "A free, MIT-licensed adapter that lets our Slim services render HTML with Twig — the same templating engine used across the PHP/Symfony ecosystem. It deletes custom glue code we'd otherwise own forever, is maintained by the Slim organization, and gives us one consistent way to render admin pages, emails, and error screens. A recent release was a pure security fix: the maintainers bumped the underlying Twig dependency to close a published vulnerability, which is the behaviour we want from a dependency. Cost is zero; risk is low and community-supported, so we budget a small contingency to fork if maintenance stalls. Note it does not apply to our Laravel services, which stay on Blade — though the same Twig version floor should be verified anywhere else we run Twig."
To engineering: "slim/twig-view binds Slim 4's view layer to Twig 3: register Twig in the container, get a configured Environment — loader paths, caching, extensions, strict_variables — and render() hands back a PSR-7 response. Upgrade action from 3.4.1: the package now requires twig/twig >= 3.11.1 to remediate GHSA-6j75-5wfj-gh66. Before bumping, run composer why twig/twig and composer audit across affected services to confirm nothing else pins Twig lower and that no other consumer is still resolved to a vulnerable version. Bump the lockfile, re-run composer audit to confirm a clean result, and re-snapshot rendered-output tests (a patch bump shouldn't change output, but deprecation notices or stricter escaping behaviour in a minor Twig change can surface at render time). No API change here, so no code migration. Lock-in stays low; the escape hatch is a ~150-line custom ViewInterface implementation, so this remains a reversible decision. Keep the version pinned, watch release cadence and issue response time as our fork trigger, and treat 'adapter lags an upstream Twig advisory' — not general inactivity — as the specific signal to escalate."
How can I help you explore Laravel packages today?