Search by

symfony / polyfill-intl-char

fabpot

Symfony polyfill for intl's IntlChar class

v1.44.0 2026-11-15 13:53 UTC

This package is auto-updated.

Last update: 2026-11-15 14:20:21 UTC


README

This component provides a partial, native PHP implementation of the IntlChar class provided by the Intl extension: the properties of code points from the Unicode Character Database, like those the Unicode Bidirectional Algorithm needs.

  • charDirection(), charMirror(), isMirrored() and getBidiPairedBracket();
  • charType() and enumCharTypes(), and the predicates derived from the general category, like ICU: isalpha(), isdigit(), isspace(), isWhitespace(), ispunct(), isgraph(), isprint(), isIDStart(), isJavaIDPart()...;
  • hasBinaryProperty() for all the binary properties of ICU (emoji ones, NFC_Inert, Segment_Starter... included), and isUAlphabetic(), isULowercase(), isUUppercase() and isUWhiteSpace();
  • getIntPropertyValue(), getIntPropertyMinValue() and getIntPropertyMaxValue() for all the enumerated properties but the blocks and the scripts: the bidi class, the general category, the combining classes, the decomposition type, the East Asian width, the line, grapheme cluster, word and sentence breaks, the joining type and group, the Hangul syllable type, the numeric type, the normalization quick checks, the Indic categories, the vertical orientation...;
  • tolower(), toupper(), totitle() and foldCase(), the simple case mappings;
  • getCombiningClass(), charDigitValue(), digit(), forDigit(), getNumericValue() and charAge();
  • ord(), chr(), getUnicodeVersion() and all the constants of IntlChar.

Code points are given as integers or as strings of one UTF-8 character, as with the Intl extension, and the data are those of Unicode 17.0: every code point gives what Intl gives with ICU 78. The names of characters (charName(), charFromName(), enumCharNames()), their blocks (getBlockCode()) and scripts, whose numbers are ICU's own, and the names of properties and of their values are not provided: these methods throw a LogicException.

The data take 495 KB, one file a property, loaded when a method needs it.

More information can be found in the main Polyfill README.

License

This library is released under the MIT license.