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 Laravel Package

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.

Deep Wiki
Context7

Product Decisions This Supports

  • Feature scope for presentation-layer formatting. The package bundles Twig filters for localized dates/times, text truncation/excerpts, and regex/text helpers. This lets you ship user-facing formatting (localized timestamps, teaser copy, slug/regex cleanup) without building and maintaining a custom Twig extension.
  • Build vs. buy vs. vendor. With an MIT license and a small surface area, the realistic options are: (a) adopt the package, (b) copy the handful of filters you actually use into an internal extension, or (c) use Twig’s official twig/*-extra packages. The decision is low-stakes technically but should be made deliberately, because the package’s last release was October 2020.
  • Roadmap input for internationalization and content UX. If the roadmap includes localization, CMS-driven themes, email templates, or admin dashboards rendered with Twig, these filters remove a recurring “we need a custom filter for that” ticket. They do not address translation workflows, locale negotiation, or timezone policy — those remain product/platform decisions.
  • Use-case fit. Strongest fit: Twig-based PHP apps (Symfony, Slim, Craft CMS, Drupal themes, standalone Twig). Weak fit: Laravel, which is Blade-first. Adopting this package in a Laravel codebase presupposes you have already decided to introduce Twig via a bridge or standalone rendering — a much larger architectural decision than adding a filter library.
  • Risk-informed adoption. 107 stars, an unknown/unverified repository, and a five-year-old release mean this is a convenience dependency, not a strategic one. Treat it as code you may need to fork or vendor, and budget a small compatibility spike against current Twig 3.x and PHP 8.x.

When to Consider This Package

Consider it when:

  • You already render Twig templates and need localized date/time output, truncation, or regex/text helpers with minimal effort.
  • You want a permissively licensed (MIT), dependency-light library you can pin, vendor, or fork if maintenance stalls.
  • The alternative is writing one or two custom Twig extensions, and you have validated that the package’s filters match your formatting and locale requirements.
  • You have run a compatibility check against your Twig/PHP versions and added template-level tests for the filters you depend on.

Look elsewhere when:

  • Your stack is Laravel/Blade. Use Carbon for date formatting, Illuminate\Support\Str for truncation, and Blade directives/components. Adding Twig here is an architecture change, not a package decision.
  • You need maintained, first-party support. Prefer Twig’s official extra packages (twig/intl-extra, twig/string-extra, twig/extra-bundle) for locale-aware formatting and string helpers.
  • You need real i18n. Use Symfony Translation or Laravel’s localization; formatting filters are not a translation strategy.
  • Regex or data shaping would live in templates. Business logic and security-sensitive pattern matching belong in the service/domain layer, not in view filters.
  • Supply-chain review is strict. An unverified repository with a stale release may fail dependency governance; in that case, vendor the specific filters with attribution.

How to Pitch It (Stakeholders)

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.

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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource