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.
The symfony/polyfill-intl-icu package aligns seamlessly with Laravel’s architecture, particularly for projects requiring globalization, RTL support, or PHP 8.5 compatibility without the intl extension. Key architectural synergies include:
Illuminate\Support\Facades\Lang and Carbon for RTL-aware UI adjustments (e.g., dynamic text direction, form alignment) via locale_is_right_to_left().IntlListFormatter, a critical feature for localized list patterns (e.g., "A, B, and C") without extension dependencies.Collator, NumberFormatter, IntlDateFormatter), addressing gaps in Laravel’s data presentation layer without architectural refactoring.^1.34.0) to unlock features like RTL detection and IntlListFormatter. Existing Intl APIs (e.g., new Collator()) remain functional, ensuring backward compatibility.ext-intl is unavailable, eliminating runtime errors and reducing deployment complexity.intl (critical for bulk operations like large datasets; benchmark for search/sort-heavy applications).NumberFormatter/IntlDateFormatter may degrade non-English UX (e.g., incorrect date patterns in Thai, Hindi). Mitigation: Restrict usage to English or temporary fallbacks.locale_is_right_to_left() in target locales (e.g., ar, he) to ensure UI consistency (e.g., CSS classes, form layouts). Test with mixed-script content (e.g., Arabic + Latin).Collator::compare() may fail with complex datasets (e.g., Arabic + Latin characters). Mitigation: Cache results or plan for ext-intl upgrades.ext-intl will experience degraded functionality (e.g., list patterns, pluralization). Mitigation: Use only for English or as a stopgap until ext-intl is available.IntlListFormatter thoroughly on PHP 8.5.locale_is_right_to_left() in RTL locales (ar, he) and validate frontend responses (e.g., Tailwind/Bootstrap classes).IntlListFormatter used or planned for localized lists (e.g., "A, B, and C")?Collator::compare() for search/filtering/sorting?ext-intl?intl extension upgrades if full i18n is required post-MVP.ext-intl?ext-intl for production once the polyfill is validated?IntlListFormatter.composer.json beyond the package update; autoloading handles integration automatically.composer require symfony/polyfill-intl-icu:^1.34.0
locale_is_right_to_left() in ar/he locales and adjust UI components (e.g., CSS classes, form alignment).IntlListFormatter for localized list patterns (e.g., "A, B, and C").Collator::compare() handles edge cases (e.g., mixed-script strings) and benchmark performance.IntlListFormatter for locale-aware lists in views/APIs (e.g., IntlListFormatter::format($items)).locale_is_right_to_left() to dynamic UI adjustments (e.g., rtl CSS classes in Blade templates).intl_is_failure() checks with polyfill for error handling.extension_loaded('intl') to log polyfill usage and plan for future ext-intl upgrades.Collator results for performance-critical paths.IntlListFormatter.locale_is_right_to_left) and basic formatting.ar/he locales.IntlListFormatter for localized lists.Collator::compare() and implement caching for critical paths.ext-intl upgrades based on polyfill usage metrics.extension_loaded('intl') to track polyfill usage and plan for future upgrades.intl_get_error_message() for diagnostics.Collator and formatting operations. Benchmark under load and cache results for critical paths (e.g., search/sort).locale_is_right_to_left() results may misalign UI components (e.g., forms, text direction).Collator::compare() may produce inconsistent results for mixed-script content.NumberFormatter/IntlDateFormatter may break non-English UX.How can I help you explore Laravel packages today?