symfony/polyfill-php86
Symfony polyfill that backports PHP 8.6 features to older PHP versions, including clamp(), the ARRAY_FILTER_USE_VALUE constant, the SortDirection enum, and grapheme_strrev. A lightweight MIT-licensed compatibility layer for existing projects.
Architecture fit
grapheme_strrev(), Collator sorting, English list patterns, and MessageFormatter integer rounding. That is intl/ICU-adjacent behavior, not the clamp()/sorting-enum surface described in prior sample snippets. The polyfill is best understood as a compatibility shim for internationalization and string primitives, and it fits libraries and shared packages that need deterministic i18n behavior across a wide PHP range.ext-intl installed, direct adoption remains largely unnecessary. The valuable case is a dependency or internal package that calls these symbols and must run where native support is absent or version-variant.Integration feasibility
composer require symfony/polyfill-php86, Composer autoload, no Laravel service provider in the normal case. Polyfilled symbols are typically conditionally defined only when native PHP or the relevant extension does not supply them.clamp(). Confirm whether symbols are global, namespaced, gated on ext-intl presence, or gated on PHP version.ext-intl. Weak case: adding it to a Laravel app to obtain one helper.ext-intl will not exercise the polyfill. Feasibility testing must include a no-intl environment or the polyfill path is never actually validated.Technical risk
Key questions
grapheme_strrev, Collator sorting, MessageFormatter, or list patterns — in which module, and why can a local helper or ext-intl not satisfy it?ext-intl? If yes in production but no in CI (or vice versa), which path are we actually testing?Stack fit
symfony/polyfill-* packages, ext-intl usage, Laravel's Str/Number helpers, and any custom grapheme or collation utilities. Duplicate or conflicting implementations are the main integration hazard.Migration path
ext-intl.ext-intl where feasible.Compatibility
ext-intl, and native behavior where available. Without the no-intl leg, the polyfill path is untested.Sequencing
ext-intl or a local helper.Maintenance
composer why symfony/polyfill-php86 before any removal to separate direct from transitive usage.Support
Scaling
Failure modes
ext-intl produce different results for identical input. Mitigate with a standardized runtime baseline or explicit CI coverage of both paths.Ramp-up
How can I help you explore Laravel packages today?