photogabble / php-confusable-homoglyphs
PHP port of the Python library confusable_homoglyphs
Requires
- php: >=7.0.0
- ext-json: *
- symfony/polyfill-mbstring: >=1.3
Requires (Dev)
- phpunit/phpunit: 6.*|7.*
This package is auto-updated.
Last update: 2024-11-18 05:00:42 UTC
README
A PHP port of vhf/confusable_homoglyphs
About this package
Unicode homoglyphs can be a nuisance on the web. Your most popular client, AlaskaJazz, might be upset to be impersonated by a trickster who deliberately chose the username ΑlaskaJazz. (The A is the greek letter capital alpha)
This is a complete port of the Python library vhf/confusable_homoglyphs to PHP. I found myself needing its functionality after reading this article by James Bennett on validating usernames and how django-registration does so.
A huge thank you goes to the Python package creator Victor Felder and its contributors Ryan Kilby and muusik; without their work this port would not exist.
This library is compatible with PHP versions 7.3 and above.
Install
Install this library with composer: composer require photogabble/php-confusable-homoglyphs
.
Usage
Please see the tests for detailed example of usage.
Known Usage
- Laravel Registration Validator package
- If you use this package in your open source project please create a pull request to add a link here
Is the data up to date?
This project currently ships with unicode consortium public data version 10.0.0.
The unicode blocks aliases and names for each character are extracted from this file provided by the unicode consortium.
The matrix of which character can be confused with which other characters is built using this file provided by the unicode consortium.
The version this project currently ships with was generated on the 17th Feb 2022.