php8.5
Home/ Manual/ reference / intl/ The Spoofchecker class

The Spoofchecker class

This class is provided because Unicode contains large number of characters and incorporates the varied writing systems of the world and their incorrect usage can expose programs or systems to possible security attacks using characters similarity.

Intro

This class is provided because Unicode contains large number of characters and incorporates the varied writing systems of the world and their incorrect usage can expose programs or systems to possible security attacks using characters similarity.

Provided methods allow to check whether an individual string is likely an attempt at confusing the reader (spoof detection), such as "pаypаl" spelled with Cyrillic 'а' characters.

Class synopsis

class Spoofchecker { }

Predefined Constants

Spoofchecker::SINGLE_SCRIPT_CONFUSABLEint
Spoofchecker::MIXED_SCRIPT_CONFUSABLEint
Spoofchecker::WHOLE_SCRIPT_CONFUSABLEint
Spoofchecker::ANY_CASEint
Spoofchecker::SINGLE_SCRIPTint
Spoofchecker::INVISIBLEint
Spoofchecker::CHAR_LIMITint
Spoofchecker::ASCIIint
Spoofchecker::HIGHLY_RESTRICTIVEint
Spoofchecker::MODERATELY_RESTRICTIVEint
Spoofchecker::MINIMALLY_RESTRICTIVEint
Spoofchecker::UNRESTRICTIVEint
Spoofchecker::SINGLE_SCRIPT_RESTRICTIVEint
Spoofchecker::MIXED_NUMBERSint
Spoofchecker::HIDDEN_OVERLAYint
Spoofchecker::IGNORE_SPACEint
Spoofchecker::CASE_INSENSITIVEint

Enables case-insensitive matching

Spoofchecker::ADD_CASE_MAPPINGSint

Adds all case mappings for each element in the set

Spoofchecker::SIMPLE_CASE_INSENSITIVEint

Enables case-insensitive matching

Changelog

VersionDescription
8.4.0Added Spoofchecker::IGNORE_SPACE, Spoofchecker::CASE_INSENSITIVE, Spoofchecker::ADD_CASE_MAPPINGS, Spoofchecker::SIMPLE_CASE_INSENSITIVE.
8.4.0The class constants are now typed.
7.3.0Class constants used by Spoofchecker::setRestrictionLevel() such as Spoofchecker::ASCII, Spoofchecker::HIGHLY_RESTRICTIVE, Spoofchecker::MODERATELY_RESTRICTIVE, Spoofchecker::MINIMALLY_RESTRICTIVE, Spoofchecker::UNRESTRICTIVE, Spoofchecker::SINGLE_SCRIPT_RESTRICTIVE has been added.

Spoofchecker

In this section

Source: reference/intl/spoofchecker.xml · from the official PHP manual (php/doc-en)