Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Twig Extensions Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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.

  • Maturity: 0 stars, 0 dependents, score 0. There is no observable consumer base, which means no battle-testing and no ecosystem pressure to fix bugs.
  • Maintenance: StingerSoft publishes a family of small bundles; activity is uneven. Assume you own the code from the moment you adopt it.
  • Version coupling: Twig 2 → 3 → 4 has removed or deprecated extension APIs (e.g., 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.
  • Licensing: Apache-2.0 is permissive and business-friendly; no legal blocker, and it permits forking with attribution.
  • Supply chain: Low blast radius (small package, likely few transitive deps), but also low scrutiny — pin and vendor-review the code before it enters the lockfile.

Key questions for the maintainer/owner.

  1. Which specific Twig extensions does this bundle ship (filters, functions, tests, globals), and which of them do we actually need? Most "extensions bundles" are 80% unused surface.
  2. Supported Twig major version and PHP version range?
  3. Is there a framework-agnostic package (stinger-soft/twig-extensions) we can depend on directly, bypassing Symfony entirely?
  4. Test coverage and CI status? Any tests at all?
  5. Who is the accountable maintainer if a Twig upgrade breaks a filter we depend on?
  6. Does any extension perform I/O (filesystem, HTTP, DB) inside a filter? That changes the runtime and caching story materially.

Integration Approach

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.

  • Step 1 — Inventory. Diff the bundle's extension list against what Laravel/Twig Bridge, twig/extra-bundle (or its standalone equivalents), and existing in-house helpers already provide. Expect overlap; drop the overlaps.
  • Step 2 — Decouple. Fork to an internal namespace (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.
  • Step 3 — Bind. Register extensions in a dedicated TwigExtensionsServiceProvider; keep the registration list explicit rather than auto-discovered so the dependency surface is auditable.
  • Step 4 — Pin. Commit the fork to our VCS with a 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.

Operational Impact

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.

  • Silent non-registration: extension not added to the environment → Unknown "xyz" filter at render time, potentially only on rarely-hit templates. Mitigate with a boot-time smoke test.
  • Twig major upgrade breakage: signature drift in TwigFilter/TwigFunction constructors surfaces as fatal errors, not deprecations. Mitigate by pinning and by an integration test that renders a template exercising each filter.
  • Symfony leakage: a fork that only partially strips Symfony imports will fail at autoload or container-resolution time in subtle ways. Mitigate by removing the DependencyInjection/ directory wholesale and letting unused-code errors surface.
  • Abandonware drift: two years from now the fork diverges from a Twig API that no longer resembles the original; the cost is a rewrite, not a patch.

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."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator