- What is symfony/polyfill-intl-messageformatter used for in Laravel?
- It provides a pure-PHP implementation of PHP's MessageFormatter class from the intl extension, so you can format ICU messages without ext-intl. Use it when your Laravel app or a dependency needs MessageFormatter, msgfmt_format_message, or related parsing and the native extension is unavailable. It supports placeholders, plural, select, and selectordinal, but it is not a full replacement for every intl feature.
- How do I install symfony/polyfill-intl-messageformatter in a Laravel app?
- Install it with Composer: composer require symfony/polyfill-intl-messageformatter. There is no Laravel installer command, service provider, or config file; Composer autoloading makes the MessageFormatter class available. Pin the version you validate, such as v1.43.0 after checking Packagist metadata and PHP constraints.
- Does symfony/polyfill-intl-messageformatter support Laravel 10, 11, or 12?
- There is no separate Laravel 10, 11, or 12 support matrix because this is a framework-agnostic Symfony polyfill with no Laravel coupling. What matters is that the package's PHP constraint for the chosen release matches your Laravel runtime and that Composer can resolve it. Check v1.43.0's composer.json, run composer why symfony/polyfill-intl-messageformatter, and test on the PHP versions you deploy.
- Do I need a service provider or config file for this polyfill in Laravel?
- No configuration is required: there is no service provider, config file, migration, or framework hook. Once installed, the polyfill supplies the MessageFormatter class through Composer autoloading when ext-intl is absent. If ext-intl is present, the native class is normally used and the polyfill is typically inert.
- How is this polyfill different from PHP's native ext-intl MessageFormatter?
- Native ext-intl is the preferred production option when it is available because it provides the real ICU implementation and locale data. The polyfill supplies compatible MessageFormatter behavior in pure PHP, including selectordinal support and fixes for rounding and list patterns in recent releases. Expect possible output drift around ICU edge cases, plural and ordinal rules, and locale data, so validate parity for the messages you rely on.
- Should I require it directly or rely on it transitively in Laravel?
- Most Laravel applications encounter it transitively through libraries that depend on MessageFormatter, so do not add a direct requirement unless your own code calls MessageFormatter or msgfmt_* functions. If it is transitive, use composer why symfony/polyfill-intl-messageformatter to confirm which version is resolved. An older resolved version may miss selectordinal support and correctness fixes present in v1.43.0.
- Which ICU message features does the polyfill support?
- It implements the MessageFormatter surface used for ICU message formatting, including format(), formatMessage(), and parse(), with support for placeholders, plural, select, and selectordinal. That covers common localization patterns such as pluralized counts and ordinal labels. It is scoped to MessageFormatter behavior rather than replacing the entire intl extension.
- How should I test the polyfill against native ext-intl in Laravel?
- Run a CI job or container that does not install ext-intl and compare its formatting and parsing output with a native ext-intl environment. Use the same message patterns and locales in both runs, and include plural, select, selectordinal, list patterns, integer rounding, and collation-related checks. Do not fake ext-intl in Composer platform config unless you intentionally want to exercise the polyfill path.
- Is symfony/polyfill-intl-messageformatter safe for production?
- It is safe to install alongside ext-intl, but production risk is moderate because polyfill output can differ from native ICU behavior in edge cases. Confirm the canonical Symfony MIT package and Packagist metadata, review the version jump from v1.38.0 to v1.43.0 for surprises, and pin the validated release. Monitor formatting failures and document what fallback occurs when ICU syntax or locale data is unsupported.
- What are alternatives to this polyfill for ICU message formatting in Laravel?
- Prefer native ext-intl where possible; for simple Laravel translation strings, Laravel's own translator may be enough. If you specifically need ICU MessageFormatter behavior without ext-intl, this Symfony polyfill is the direct fallback, and other dependencies may pull it in automatically. Maintain it by pinning a tested version, checking Symfony release notes, and rerunning parity tests when you upgrade.