PHPackages                             toxygene/confusables - 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. toxygene/confusables

ActiveLibrary

toxygene/confusables
====================

This library is an implementation of the skeleton function described in the Confusion Detection section of the Unicode Security Mechanisms technical standard.

0.7(8y ago)238↓100%MITPHPPHP &gt;=7.0.0

Since Feb 22Pushed 8y ago2 watchersCompare

[ Source](https://github.com/toxygene/confusables)[ Packagist](https://packagist.org/packages/toxygene/confusables)[ RSS](/packages/toxygene-confusables/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (9)Used By (0)

Unicode Confusables
===================

[](#unicode-confusables)

This library is an implementation of the skeleton function described in the [Confusion Detection](http://unicode.org/reports/tr39/#Confusable_Detection) section of the [Unicode Security Mechanisms technical standard](http://unicode.org/reports/tr39/).

> Because Unicode contains such a large number of characters and incorporates the varied writing systems of the world, incorrect usage can expose programs or systems to possible security attacks.
>
> \-

Description
===========

[](#description)

The `skeleton` function deconstructs complex Unicode graphemes into a string that can be used to detect if other strings are visually similar (aka confusable).

Usage
=====

[](#usage)

(Re) Building the Class File
----------------------------

[](#re-building-the-class-file)

The Confusable class file is generated by `bin/build-confusables`. That build script will automatically be called by composer on install/update.

The reason the class file is built dynamically is two fold:

- The [confusables.txt file](https://www.unicode.org/Public/security/latest/confusables.txt) is quite large (~120k). Caching them locally is an improvement, but it still requires a disk read and parsing.
- Injecting the confusables rules into the PHP file it can be stored in PHP byte-code caches.

Should the Unicode confusables.txt file be updated, developers can rerun the build script at any time, even via a cronjob.

API
---

[](#api)

### skeleton(string $a): string

[](#skeletonstring-a-string)

Create the `skeleton` of a string.

Storing this value in the database will give developers a way of doing a visual uniqueness check against existing identifiers.

### isConfusable(string $a, string $b): bool

[](#isconfusablestring-a-string-b-bool)

Check if two strings are confusable for each other.

Under the hood, this is implemented as `skeleton(A) == skeleton(B)`.

Warning
=======

[](#warning)

Casefolding is **not** part of the `skeleton` algorithm. If the requirements of your application include casefolding identifiers, it is your responsibility to supply the strings in the correct case to the `skeleton` function.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.7% 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 ~1 days

Total

7

Last Release

2996d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0ef1879223954bc1f9929a48400ea9af7383a1352272b86ec37160e44dee24f?d=identicon)[toxygene](/maintainers/toxygene)

---

Top Contributors

[![toxygene](https://avatars.githubusercontent.com/u/350210?v=4)](https://github.com/toxygene "toxygene (38 commits)")[![nerdery-jhendric](https://avatars.githubusercontent.com/u/9341179?v=4)](https://github.com/nerdery-jhendric "nerdery-jhendric (3 commits)")

---

Tags

confusablephpunicode

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/toxygene-confusables/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[symfony/http-foundation

Defines an object-oriented layer for the HTTP specification

8.6k877.8M5.2k](/packages/symfony-http-foundation)[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M719](/packages/psy-psysh)[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k855.5M8.0k](/packages/symfony-var-dumper)[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)

PHPackages © 2026

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