jasny/twig-extensions
Jasny Twig Extensions adds practical filters and functions to Twig for common template tasks, including array manipulation, date/time formatting, and string helpers like truncation and slugs. A lightweight way to reduce custom Twig code in PHP apps.
twig/*-extra packages. The decision is low-stakes technically but should be made deliberately, because the package’s last release was October 2020.Consider it when:
Look elsewhere when:
Illuminate\Support\Str for truncation, and Blade directives/components. Adding Twig here is an architecture change, not a package decision.twig/intl-extra, twig/string-extra, twig/extra-bundle) for locale-aware formatting and string helpers.For executives: This is a small, MIT-licensed utility library that gives our Twig templates ready-made formatting helpers — localized dates, text truncation, regex/text cleanup. It saves a few days of custom extension work on presentation features and carries effectively no licensing cost. It is a convenience dependency, not a platform bet: the project has a small community (~100 stars) and hasn’t shipped a release since 2020, so we should adopt it narrowly, pin the version, and be prepared to vendor or replace it.
For engineering: Framework-agnostic PHP, MIT, small footprint, easy to fork. Before adoption, verify compatibility with our Twig 3.x/PHP 8.x versions, add tests around the specific filters we use, and confirm we are not pulling regex or business logic into templates. Note that on Laravel/Blade this package is largely irrelevant unless we have already committed to Twig; on Symfony or other Twig stacks, the official twig/*-extra packages are the lower-risk default, with this package as a fallback for the specific filters they don’t cover.
How can I help you explore Laravel packages today?