PHPackages                             wikimedia/ipa-validator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. wikimedia/ipa-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

wikimedia/ipa-validator
=======================

Composer package for validating and normalizing IPA

v1.1.1(3y ago)217GPL-2.0-or-laterPHPPHP &gt;=7.4

Since Aug 19Pushed 1mo ago22 watchersCompare

[ Source](https://github.com/wikimedia/mediawiki-libs-IPAValidator)[ Packagist](https://packagist.org/packages/wikimedia/ipa-validator)[ RSS](/packages/wikimedia-ipa-validator/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (6)Versions (13)Used By (0)

Composer package for validating and normalizing IPA
===================================================

[](#composer-package-for-validating-and-normalizing-ipa)

Basic usage
-----------

[](#basic-usage)

```
// Load composer's autoloader
require_once __DIR__ . '/vendor/autoload.php';

// Load the validator
use Wikimedia\IPAValidator\Validator;

/*
* Create a new validator with the options:
*  - Remove delimiters (defaults to true)
*  - Normalize IPA (defaults to false)
*  - Normalize to Google TTS standard (defaults to false)
*/
$validator = new Validator( '/pʰə̥ˈkj̊uːliɚ/', true, true, true );

// Check if the IPA is valid
echo $validator->valid;  # true

// Get the normalized IPA
echo $validator->normalizedIPA;  # phəˈkjuːliɚ

// Get the original IPA
echo $validator->originalIPA;  # /pʰə̥ˈkj̊uːliɚ/
```

Options
-------

[](#options)

When constructing a new `Validator`, you can set the following options:

```
/**
 * Constructor
 *
 * @param string $ipa IPA to validate
 * @param bool $strip Remove delimiters
 * @param bool $normalize Normalize IPA
 * @param bool $google Normalize IPA for Google TTS
 */
public function __construct( $ipa, $strip = true, $normalize = false, $google = false )
```

### Remove delimiters

[](#remove-delimiters)

This option will remove *some* delimiters from the IPA — currently `/.../` and `[...]`

### Normalize IPA

[](#normalize-ipa)

When `$google` is `false`, this option will normalize the IPA and remove commonly mistaken unicode characters (for example, using `:` instead of `ː` in a word such as `tenoːt͡ʃˈtit͡ɬan`).

### Normalize IPA for Google TTS

[](#normalize-ipa-for-google-tts)

As part of a work project, we're feeding IPA to Google's TTS engine — Google is a little opinionated about things like diacritics. For example, the IPA `ˈɔːfɫ̩` would not render correctly in Google TTS. A custom charmap is used to normalize certain characters:

```
$charmap = [
    [ '(', '' ],
    [ ')', '' ],
    // 207F
    [ 'ⁿ', 'n' ],
    // 02B0
    [ 'ʰ', 'h' ],
    // 026B
    [ 'ɫ', 'l' ],
    // 02E1
    [ 'ˡ', 'l' ],
    // 02B2
    [ 'ʲ', 'j' ],
];
```

Setting `$google` to `true` also removes all diacritics from the IPA string.

The Regex
---------

[](#the-regex)

```
^[().a-z|æçðøħŋœǀ-ǃɐ-ɻɽɾʀ-ʄʈ-ʒʔʕʘʙʛ-ʝʟʡʢʰʲʷʼˀˈˌːˑ˞ˠˡˤ-˩̴̘̙̜̝̞̟̠̤̥̩̪̬̯̰̹̺̻̼̀́̂̃̄̆̈̊̋̌̏̽̚͜͡βθχ᷄᷅᷈‖‿ⁿⱱ]+$

```

I've also placed it at  if you think you can improve it... (**please do**!)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance58

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.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 ~8 days

Recently: every ~19 days

Total

12

Last Release

1323d ago

PHP version history (3 changes)v1.0.6PHP &gt;=7.3

v1.0.9PHP &gt;=7.2

v1.1.0PHP &gt;=7.4

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

![](https://avatars.githubusercontent.com/u/375162?v=4)[Sammy](/maintainers/theresnotime)[@theresnotime](https://github.com/theresnotime)

---

Top Contributors

[![theresnotime](https://avatars.githubusercontent.com/u/375162?v=4)](https://github.com/theresnotime "theresnotime (22 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (6 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (6 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (3 commits)")[![ZabeMath](https://avatars.githubusercontent.com/u/35405030?v=4)](https://github.com/ZabeMath "ZabeMath (1 commits)")[![MusikAnimal](https://avatars.githubusercontent.com/u/366374?v=4)](https://github.com/MusikAnimal "MusikAnimal (1 commits)")[![somechris](https://avatars.githubusercontent.com/u/3330451?v=4)](https://github.com/somechris "somechris (1 commits)")[![dayllanmaza](https://avatars.githubusercontent.com/u/680583?v=4)](https://github.com/dayllanmaza "dayllanmaza (1 commits)")

---

Tags

ipaphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wikimedia-ipa-validator/health.svg)

```
[![Health](https://phpackages.com/badges/wikimedia-ipa-validator/health.svg)](https://phpackages.com/packages/wikimedia-ipa-validator)
```

PHPackages © 2026

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