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

Intl Extra Laravel Package

twig/intl-extra

Twig Intl Extension adds locale-aware filters to Twig: look up country, currency, language, locale, and timezone names, get country timezones, and format currencies, numbers, dates, times, and lists using PHP's Intl extension.

View on GitHub
Deep Wiki
Context7

Twig Intl Extension adds locale-aware filters to Twig by wrapping PHP's intl extension, so templates can display localized country, currency, language, locale, and timezone names and format numbers, currencies, dates, and times without extra PHP logic in controllers.

  • Localized names: country_name, currency_name, currency_symbol, language_name, locale_name, timezone_name
  • Number & currency formatting: format_number, format_currency
  • Date & time formatting: format_date, format_time, format_datetime
  • List formatting: format_list joins strings into a locale-aware list
  • Lookups: country_timezones returns timezone identifiers for a country code
Frequently asked questions about Intl Extra
Does twig/intl-extra work with Laravel?
Only if Twig is already in your rendering path. twig/intl-extra is an official Twig extension, not a Laravel package, so it registers filters such as format_currency and country_name on a Twig environment rather than on Blade. In a Blade-only Laravel app it adds no value, but it fits Twig-rendered surfaces like invoice PDFs, exports, emails, and Symfony-shared components.
How do I install twig/intl-extra in a Laravel project?
Run composer require twig/twig twig/intl-extra, then add the extension to your Twig environment with addExtension(new \Twig\Extra\Intl\IntlExtension()). You also need the PHP intl extension enabled and a compiled-template cache configured. If your Laravel app does not already use Twig, adopting this package means introducing a Twig-to-Laravel bridge, which is the real integration cost.
What Twig filters does twig/intl-extra provide?
It adds locale-aware formatting filters including format_number, format_currency, format_date, format_time, format_datetime, and format_list. It also adds ISO name lookups such as country_name, currency_name, currency_symbol, language_name, locale_name, timezone_name, and country_timezones. All of these are backed by PHP's intl extension and ICU data.
Is twig/intl-extra a replacement for Laravel's Number helper and Carbon?
No, it overlaps with native Laravel capabilities rather than replacing them. Laravel 10+ ships Illuminate\Support\Number for currency, number, and percentage formatting, and Carbon handles localized dates, while __() and trans_choice() cover translations. The extension mainly adds ISO code-to-name lookups and ICU pattern control inside Twig templates.
What are the requirements for twig/intl-extra?
You need PHP 8.1 or newer, Twig 3.x aligned with the extension version, and the PHP intl extension enabled. The intl extension is not guaranteed in slim php:*-cli images unless you explicitly install it. A compiled Twig template cache is also recommended for production performance.
How do I set the locale for Twig Intl filters in Laravel?
Twig Intl filters accept an explicit locale argument, but Laravel stores locale via App::setLocale(), so you must connect the two. A common approach is to expose app()->getLocale() as a Twig global or function and pass it to filters consistently. Without a single source of truth, requests and queue jobs can format dates and currencies with different locales.
Why do twig/intl-extra currency and date outputs differ between local and production?
ICU data drift is the usual cause: intl behavior depends on the ICU library bundled with your PHP build. Your laptop, CI image, and production container can produce different currency spacing, timezone names, and date patterns. Pin the PHP base image and run a locale matrix in CI to catch differences before deployment.
Is twig/intl-extra safe to use with Laravel Octane and queue workers?
Yes, provided you use a patched version. Version 3.26.0 fixed CVE-2026-46629, which involved unbounded memoization of IntlDateFormatter and NumberFormatter instances and mattered for long-lived workers like Octane and Horizon. Constrain the package to ^3.26 and run composer audit in CI. Also handle formatter exceptions, since invalid ICU patterns and unsupported locales throw rather than degrade gracefully.
How should I test twig/intl-extra filters in a Laravel app?
Test a locale matrix rather than a single locale, because ICU output varies by language and region. Pass explicit locales in tests instead of relying on the application default, and assert on formatted strings for numbers, currencies, dates, and lists. Run those tests in CI on the same PHP and ICU base image you deploy.
What are the alternatives to twig/intl-extra for locale-aware formatting in Laravel?
For Blade-only applications, a thin IntlFormatter service using NumberFormatter and IntlDateFormatter, exposed through Blade directives, avoids introducing Twig. You can also rely on Illuminate\Support\Number, Carbon's localized formatting, and Laravel's translation helpers for most needs. Choose twig/intl-extra only when Twig templates already exist and you want these filters without custom PHP plumbing.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo