symfony/polyfill-intl-normalizer
Fallback implementation of PHP’s Intl Normalizer class for environments without the intl extension. Part of Symfony’s polyfill suite, enabling Unicode normalization features across platforms while keeping compatibility with native Normalizer when available.
This package is a drop-in fallback for PHP applications that rely on the Normalizer class from the intl extension, but need to run on environments where that extension is not installed (e.g., shared hosting or minimal Docker containers).
First use case: Detect if Normalizer exists and fall back gracefully — but with this polyfill, you don’t need to — just use Normalizer::normalize() as usual. Composer will auto-install it when required (via symfony/polyfill-intl-* or direct dependency).
Start here:
Normalizer docs on PHP.net — the polyfill mirrors the exact API.composer require symfony/polyfill-intl-normalizer to install.Normalizer::normalize($string, Normalizer::FORM_C) — it just works on non-intl-enabled systems.$safeInput = Normalizer::normalize(trim($_POST['username']), Normalizer::FORM_C);
$dbTerm = Normalizer::normalize($row['title'], Normalizer::FORM_C);
$query = Normalizer::normalize($searchTerm, Normalizer::FORM_C);
if ($dbTerm === $query) { /* match */ }
Normalizer::isNormalized($string, Normalizer::FORM_C) to gate heavy normalization logic.intl extension, especially for long strings. Profile before using in hot loops.Normalizer::FORM_* constants are defined (C, D, KC, KD). Using undefined constants (e.g., Normalizer::YES) will fail — always rely on Normalizer::FORM_* values.mbstring extension; if missing, polyfill fails silently with E_USER_WARNING. Verify extension_loaded('mbstring') in dev environments.normalize() alone — combine with mb_strtolower() or Normalizer::normalize($s, Normalizer::FORM_KC)->strtolower().intl by overriding class_exists('Normalizer') in unit tests via reflection, or set up a GitHub Actions job with ext-intl: false.How can I help you explore Laravel packages today?