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 support RTL (right-to-left) languages like Arabic or Hebrew without the `intl` extension?
Yes, but with limitations. The polyfill provides basic RTL detection via `locale_is_right_to_left()` and supports English-only ICU features. For full RTL functionality (e.g., Arabic/Hebrew sorting, formatting), you’ll still need the `intl` extension. Test `locale_is_right_to_left()` in your RTL locales and validate frontend frameworks like Tailwind or Bootstrap for CSS direction changes.
How do I install `symfony/polyfill-intl-icu` in a Laravel project?
Run `composer require symfony/polyfill-intl-icu` in your project root. No additional configuration is needed—it automatically replaces missing ICU functionality if the `intl` extension is unavailable. Ensure your `composer.json` requires a compatible version (e.g., `^1.34.0`).
Will this polyfill work with Laravel’s localization system (e.g., `Lang::get()`, Carbon) for non-English locales?
No, this polyfill is **English-only** and only provides fallbacks for ICU-related classes like `Collator` or `NumberFormatter`. For non-English locales (e.g., Thai, Hindi), you’ll need the `intl` extension. Use it as a temporary solution or for English-specific features like list formatting (`IntlListFormatter`).
Does `symfony/polyfill-intl-icu` support PHP 8.5’s new `IntlListFormatter` in Laravel?
Yes, the polyfill includes `IntlListFormatter` support for PHP 8.5, enabling localized list patterns (e.g., “A, B, and C”). However, this is English-only. If you’re targeting PHP 8.5, update your Laravel project (requires PHP 8.1+) and verify the formatter works with your locales. Benchmark performance for large lists.
Is there a performance impact if I use `Collator::compare()` with this polyfill in Laravel?
Yes, the polyfill’s `Collator::compare()` is **5–10x slower** than the native `intl` extension. Avoid using it for bulk operations like sorting large datasets or search filters. Cache results or plan to upgrade to the `intl` extension for production if performance is critical.
Can I use this polyfill as a replacement for the `intl` extension in production?
No, it’s a **temporary fallback** for environments where `intl` isn’t available (e.g., shared hosting). For full i18n support (non-English locales, complex sorting, or formatting), install the `intl` extension. Monitor usage logs and prioritize upgrading once feasible.
Will this polyfill break existing Laravel code that uses `intl` functions?
No, it’s designed for **zero-configuration fallback**. If the `intl` extension is installed, the polyfill won’t interfere. Only when `intl` is missing will it silently replace ICU classes. Test your app’s ICU-dependent features (e.g., `IntlDateFormatter`) to confirm compatibility.
Are there alternatives to `symfony/polyfill-intl-icu` for Laravel RTL or ICU support?
For RTL, consider Laravel’s built-in `locale_is_right_to_left()` with CSS frameworks (e.g., Tailwind’s RTL classes). For ICU, the `intl` extension is the only full-featured solution. Other polyfills (e.g., `php-intl-icu`) are less maintained. This Symfony polyfill is the most Laravel-friendly option for temporary fixes.
How do I test if the polyfill is working in my Laravel app?
Check if ICU classes are autoloaded by running `php artisan tinker` and testing `new Collator()` or `new IntlDateFormatter()`. If no errors appear, the polyfill is active. For RTL, verify `locale_is_right_to_left('ar')` returns `true`. Compare output with a system where `intl` is installed to spot English-only limitations.
Does this polyfill support mixed-script sorting (e.g., Arabic + Latin characters) in Laravel?
No, the polyfill’s `Collator` handles **English-only** sorting. Mixed-script sorting (e.g., Arabic + Latin) will fail or produce incorrect results. Cache results or upgrade to the `intl` extension for complex datasets. Test with `Collator::compare()` on mixed-script strings to confirm limitations.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony