stinger-soft/twig-extensions-bundle
A Symfony bundle from Stinger Soft that provides a collection of Twig extensions, adding handy filters, functions and tags to your templates. Drop it into your project to extend Twig's built-in capabilities and keep view logic concise.
Architecture fit. This is a Symfony Bundle, not a Laravel package, so the headline mismatch is structural rather than incidental. The bundle's value-add in a Symfony app is its Bundle class plus compiler passes that auto-tag Twig extension services (twig.extension) and merge a configuration tree. Laravel has no bundle registration model, no compiler passes, and no tag-based discovery. What is actually portable is the underlying StingerSoft Twig extension library — the filter/function/test classes themselves — not the bundle wiring. Treat the repository as a source of Twig extension code, not as an installable dependency.
Integration feasibility. Feasible but with deliberate de-scoping. In a Laravel app using Twig (typically via rcsoft/twigbridge or a custom Twig\Environment binding), you can register extension instances manually in a service provider — no bundle required. That means either (a) composer require the underlying extension library if it exists as a standalone package, or (b) fork the bundle and lift the TwigExtension classes out of the Symfony-coupled namespace. Both are a day or two of spike work, not a drop-in.
Technical risk.
Twig_Extension naming, getFunctions() return shapes, Node/Compiler signatures). Without a composer.json constraint review you cannot know whether this targets Twig 1/2/3 or PHP 7.x/8.x.Key questions for the maintainer/owner.
stinger-soft/twig-extensions) we can depend on directly, bypassing Symfony entirely?Stack fit. Moderate-to-poor as-packaged, acceptable if split. A Laravel 10/11 app renders via Blade natively; Twig is an opt-in via a bridge package. That bridge already occupies the "register Twig extensions" slot. The correct integration point is a single Laravel service provider that resolves a Twig\Environment and calls addExtension() for each StingerSoft extension class — nothing Symfony-specific survives.
Migration path.
twig/extra-bundle (or its standalone equivalents), and existing in-house helpers already provide. Expect overlap; drop the overlaps.App\Support\Twig\StingerSoft\…), strip use Symfony\… imports, remove the DependencyInjection/ and StingerSoftTwigExtensionsBundle classes, and convert any container-injected services into constructor arguments resolved by Laravel's container.TwigExtensionsServiceProvider; keep the registration list explicit rather than auto-discovered so the dependency surface is auditable.composer.json that pins twig/twig to the major we run, and add a smoke test asserting each extension is registered on the environment.Compatibility. Verify against the exact Twig major used by the bridge — Twig 3 is the realistic baseline today. Watch for Twig\Extension\AbstractExtension (Twig 2+/3) versus the removed Twig_Extension (Twig 1), and for Twig\TwigFilter/TwigFunction constructor argument order, which changed signatures across versions. Also confirm PHP 8.1/8.2 compatibility (return types, deprecations) and whether any extension type-hints Symfony interfaces we must reimplement.
Sequencing. Do the inventory and version audit before any code is forked — if the needed filters already exist in twig/extra or in-house, the work ends there. Forking and binding should be one small PR behind a feature flag, validated in a staging render path before any template is migrated to the new filters.
Maintenance. Effectively zero upstream maintenance guarantee. Budget for internal ownership: an assigned maintainer, a pinned fork, and a documented upgrade procedure whenever Twig ships a major. The realistic on-cost is a few hours per Twig major plus occasional PHP version fixes — small, but non-zero and permanent.
Support. No community, no dependents, no issue history worth citing. Escalation path is emailing StingerSoft directly or, more realistically, self-support. That is acceptable for a 200-line extension library and unacceptable if the filters become load-bearing in customer-facing templates.
Scaling. Twig extensions compile into the template's node tree; the per-request cost is the filter's own work, not the extension registration. Registration overhead is negligible if the Twig environment is a singleton. The real scaling concern is any extension doing per-render I/O or unbounded collection operations — audit for that. Compiled template caching behaves normally once extensions are stable, but note that changing extension classes invalidates the Twig cache; treat extension changes as deploy events that require a cache clear.
Failure modes.
Unknown "xyz" filter at render time, potentially only on rarely-hit templates. Mitigate with a boot-time smoke test.TwigFilter/TwigFunction constructors surfaces as fatal errors, not deprecations. Mitigate by pinning and by an integration test that renders a template exercising each filter.DependencyInjection/ directory wholesale and letting unused-code errors surface.Ramp-up. Low for a mid-level Laravel engineer — the concepts (service provider, Twig extension interface, template filters) are standard. The non-obvious part is recognising that the Symfony bundle framing is dead weight and resisting the urge to emulate a bundle system in Laravel. Estimate half a day for the audit, one to two days for fork-and-bind, half a day for tests and documentation.
TPM recommendation. Given a score of 0 with 0 dependents and 0 stars, do not adopt the bundle as a dependency. Adopt it only as reference code if a specific extension is genuinely needed and cannot be sourced from twig/extra or written in-house in under a day. The opportunity score of 18.26 reflects a package with real functional intent but no adoption signal; the correct disposition is "evaluate the filter list, fork narrowly, own it," not "add to the dependency graph."
How can I help you explore Laravel packages today?