PHPackages                             mlocati/unipoints - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mlocati/unipoints

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mlocati/unipoints
=================

A Unicode Codepoint library for PHP

1.3.0(9mo ago)281MITPHPPHP ^8.1CI passing

Since Nov 2Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/mlocati/unipoints)[ Packagist](https://packagist.org/packages/mlocati/unipoints)[ Fund](https://paypal.me/mlocati)[ GitHub Sponsors](https://github.com/mlocati)[ RSS](/packages/mlocati-unipoints/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

[![Tests](https://github.com/mlocati/unipoints/actions/workflows/tests.yml/badge.svg)](https://github.com/mlocati/unipoints/actions/workflows/tests.yml)

A Unicode Codepoint library for PHP
===================================

[](#a-unicode-codepoint-library-for-php)

Simplified Unicode Terminology
------------------------------

[](#simplified-unicode-terminology)

### Codepoints

[](#codepoints)

Codepoints are characters, spaces, symbols, punctuations, separators, ... that is, the single units that compose texts.

### Blocks

[](#blocks)

Codepoints are grouped in blocks, that is, groups of contiguous codepoints that are part of a common set.

Examples:

- a is contained in the `Basic Latin` block
- α is contained in the `Greek and Coptic` block
- 𝅘𝅥𝅮 is contained in the `Musical Symbols` block
- ↩ is contained in the `Arrows` block
- ☂ is contained in the `Miscellaneous Symbols` block

### Planes

[](#planes)

Planes are blocks of 65,536 contiguous codepoints and may contain zero, one or many blocks.

### General Category

[](#general-category)

This library also provides the general category of every codepoint, that is, you can know if a codepoint is a lowercase letter, a symbol, a punctuation, and so on.

### Surrogate Codepoints

[](#surrogate-codepoints)

In order to extend the number of codepoints that can be represented with 16 bits, Unicode introduced "Surrogates". A single character (or punctuation, ...) can be represented by combining two consecutive surrogates (called "high surrogate" and "low surrogate"). That means that such codepoints have a meaning only in pair.

Sample Usage
------------

[](#sample-usage)

Codepoints are listed in the string-backed [`MLUnipoints\Codepoint`](https://github.com/mlocati/unipoints/blob/main/src/Codepoint.php) enum. The value of the enum cases strings contain the unicode symbol: that way, for example in order to get the case of `a`, you simply can simply write:

```
use MLUnipoints\Codepoint;

$codepoint = Codepoint::from('a');
```

Since the `MLUnipoints\Codepoint` enum is rather big (it can use tens of MB of memory when you autoload it), you can also use the block-specific instances defined under the `MLUnipoints\Codepoint` namespace (but that requires that you already know the block in advance). For example:

```
use MLUnipoints\Codepoint;

$codepoint = Codepoint\Basic_Latin::from('a');
```

Every case of the `MLUnipoints\Codepoint` enum has a [`MLUnipoints\Info\CodepointInfo`](https://github.com/mlocati/unipoints/blob/main/src/Info/CategoryInfo.php) attribute. You can easily retrieve this attribute by writing

```
use MLUnipoints\Codepoint;
use MLUnipoints\Info\CodepointInfo;

$codepoint = Codepoint::from('a');
$codepointInfo = CodepointInfo::from(Codepoint::from('a'));
```

This attribute provides the numeric value of the codepoint, the Unicode name, the general category, and (if you don't use the block-specific enums) the block.

You can also similarly the details of the block, plane and the general category.

For example, this code:

```
use MLUnipoints\Codepoint;
use MLUnipoints\Info\BlockInfo;
use MLUnipoints\Info\CategoryInfo;
use MLUnipoints\Info\CodepointInfo;
use MLUnipoints\Info\PlaneInfo;

$codepoint = Codepoint::from('a');
$codepointInfo = CodepointInfo::from($codepoint);
$categoryInfo = CategoryInfo::from($codepointInfo->category);
$blockInfo = BlockInfo::from($codepointInfo->block);
$planeInfo = PlaneInfo::from($blockInfo->plane);

echo 'Codepoint: ', $codepointInfo->id, "\n";

echo 'Codepoint name: ', $codepointInfo->name, "\n";

echo 'Codepoint general category: ', $categoryInfo->description, "\n";

foreach ($categoryInfo->parentCategories as $parentCategory) {
    echo 'Codepoint parent general category: ', CategoryInfo::from($parentCategory)->description, "\n";
}

echo 'Block name: ', $blockInfo->name, "\n";

echo 'Plane name: ', $planeInfo->name, "\n";

echo 'Plane short name: ', $planeInfo->shortName, "\n";
```

will output:

```
Codepoint: 97
Codepoint name: LATIN SMALL LETTER A
Codepoint general category: a lowercase letter
Codepoint parent general category: a cased letter
Codepoint parent general category: a letter
Block name: Basic Latin
Plane name: Basic Multilingual Plane
Plane short name: BMP

```

You can also use the Unicode enums to print out characters and symbols.

For example:

```
use MLUnipoints\Codepoint;

echo Codepoint::SUN_BEHIND_CLOUD->value;
```

will print

> ⛅

Do you really want to say thank you?
------------------------------------

[](#do-you-really-want-to-say-thank-you)

You can offer me a [monthly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) 😉

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance59

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 59.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~227 days

Total

4

Last Release

291d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e9d7ece045fc89575e083ee4852edf31218df403c84f41a0de01863dae982f5?d=identicon)[mlocati](/maintainers/mlocati)

---

Top Contributors

[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (35 commits)")[![web-flow](https://avatars.githubusercontent.com/u/19864447?v=4)](https://github.com/web-flow "web-flow (12 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

unicodeemojicharacterssymbolscodepoint

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mlocati-unipoints/health.svg)

```
[![Health](https://phpackages.com/badges/mlocati-unipoints/health.svg)](https://phpackages.com/packages/mlocati-unipoints)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k430.4M1.7k](/packages/nette-utils)[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k8.0M62](/packages/rinvex-countries)[joypixels/emoji-toolkit

JoyPixels is a complete set of emoji designed for the web. The emoji-toolkit includes libraries to easily convert unicode characters to shortnames (:smile:) and shortnames to JoyPixels emoji images. PNG formats provided for the emoji images.

468894.0k7](/packages/joypixels-emoji-toolkit)[voku/portable-utf8

Portable UTF-8 library - performance optimized (unicode) string functions for php.

52323.5M49](/packages/voku-portable-utf8)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6758.1M80](/packages/jbroadway-urlify)[ausi/slug-generator

Slug Generator

8022.4M27](/packages/ausi-slug-generator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
