Weave Code
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
Polyfill Intl Icu

Polyfill Intl Icu Laravel Package

symfony/polyfill-intl-icu

Fallback implementations for PHP’s Intl ICU features when the intl extension isn’t installed. Provides limited “en” locale support for intl error functions plus Collator, NumberFormatter, Locale, IntlDateFormatter and IntlListFormatter.

View on GitHub
Deep Wiki
Context7

Symfony polyfill for intl's ICU-related data and classes

Frequently asked questions about Polyfill Intl Icu
Can I use symfony/polyfill-intl-icu in Laravel to enable RTL (right-to-left) support without installing the intl extension?
Yes, this polyfill provides `locale_is_right_to_left()` functionality, which works with Laravel’s localization system (e.g., `Lang::getLocale()`) to dynamically adjust UI direction for RTL languages like Arabic or Hebrew. Test with `locale_is_right_to_left('ar')` and validate frontend frameworks like Tailwind or Bootstrap for proper RTL styling.
How do I install symfony/polyfill-intl-icu in a Laravel project?
Add it via Composer: `composer require symfony/polyfill-intl-icu`. No additional Laravel-specific configuration is needed—it automatically replaces missing Intl functionality. Ensure your `composer.json` requires PHP 8.1+ for full compatibility with Laravel’s latest versions.
Will this polyfill work with Laravel’s Carbon for date formatting in non-English locales?
No, this polyfill only supports the 'en' locale. For non-English date formatting (e.g., Thai, Hindi), you’ll need the `intl` extension or a dedicated i18n library like `voku/portfolio`. Use `IntlDateFormatter` from this polyfill only for English dates as a temporary fallback.
Does symfony/polyfill-intl-icu support PHP 8.5’s IntlListFormatter for localized lists (e.g., ‘A, B, and C’)?
Yes, this polyfill includes `IntlListFormatter`, which is fully compatible with PHP 8.5. It’s useful for Laravel apps targeting English lists without requiring the `intl` extension. Test with `new IntlListFormatter('en', IntlListFormatter::TYPE_OR)` for expected behavior.
How does the performance of Collator::compare() compare to the native intl extension?
The polyfill’s `Collator::compare()` is ~5–10% slower than the native extension, which may impact large datasets (e.g., search filters). Benchmark critical operations and consider caching results if performance is a concern. For admin panels or small datasets, the difference is negligible.
Can I use this polyfill for sorting mixed-script strings (e.g., Arabic + Latin characters)?
No, the polyfill’s `Collator` is limited to English and may fail with complex mixed-script sorting (e.g., Arabic + Latin). For production use, prioritize installing the `intl` extension or implement custom sorting logic. Cache results if you must use the polyfill temporarily.
Is symfony/polyfill-intl-icu a full replacement for the intl extension in Laravel?
No, it’s a limited fallback for English-only use cases. It doesn’t support full i18n, pluralization, or non-English locales. Use it as a stopgap for shared hosting or CI environments, but plan to upgrade to the `intl` extension for production if you need multilingual support.
How do I test if the polyfill is working in my Laravel app?
Verify with `intl_is_failure()` or instantiate classes like `new Collator('en')`. Check RTL detection with `locale_is_right_to_left('ar')` and confirm UI adjustments (e.g., CSS classes). For dates, test `new IntlDateFormatter('en', IntlDateFormatter::LONG)` and validate output.
Will this polyfill break existing Laravel apps that already use the intl extension?
No, it’s a zero-configuration fallback. If the `intl` extension is installed, the polyfill won’t interfere. It only activates when the extension is missing, ensuring backward compatibility. No code changes are required.
Are there alternatives to symfony/polyfill-intl-icu for Laravel’s Intl needs?
For full i18n, consider the `intl` extension or libraries like `symfony/intl` (which depends on `intl`). For lightweight English-only fallbacks, this polyfill is the most integrated option. If you need non-English support, prioritize enabling the `intl` extension in production.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai