PHPackages                             carloswph/linguistics - 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. carloswph/linguistics

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

carloswph/linguistics
=====================

Linguistics and language tools in PHP.

v1.1.0(5y ago)101.0kMITPHP

Since Mar 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/carloswph/linguistics)[ Packagist](https://packagist.org/packages/carloswph/linguistics)[ RSS](/packages/carloswph-linguistics/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Linguistics
===========

[](#linguistics)

[![Codacy Security Scan](https://github.com/carloswph/linguistics/actions/workflows/codacy-analysis.yml/badge.svg)](https://github.com/carloswph/linguistics/actions/workflows/codacy-analysis.yml)[![License](https://camo.githubusercontent.com/c2e8aec5f518432893be3d854d48e19bd6bb564e2e7e99cc81860f5fe5bf84e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6361726c6f737770682f6c696e67756973746963732e737667)](https://packagist.org/packages/carloswph/linguistics)[![GitHub release](https://camo.githubusercontent.com/dd58329e6a923a53561c83ac932237b7ea0b6cc313a12cc4c07d38bef38b6e61/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e312e302d626c7565)](https://github.com/carloswph/linguistics/releases/)

**NEW --&gt;** Support to NYSIIS encoding **What's next? --&gt;** Support to Caverphone, Arpabet

This package aims to provide a comprehensive group of new functions and methods to deal with linguistics and phonetics algorithms commonly used for developing or information technology. While PHP already offers functions to encode strings in metaphone and soundex algorithms, some other useful algorithms can't be reached from native functions.

Also, this package brings a dictionary to provide immediate conversion from almost any English word, from text to IPA phonetic symbols. For this moment, just en\_US is available, but there are plans to include other languages or dialects eventually.

Installation
============

[](#installation)

The easier way of using this package is to require it using Composer - although the package can be simply cloned and used, as long as the namespaces are respected.

`composer require carloswph/linguistics`

Usage
=====

[](#usage)

This has been organized in independent classes. The first class Phonetics provide three different methods. The method symbols() converts a string in IPA phonetic symbols. If a longer string is provided, the class splits the string in words, returning the respective symbology to all words, excluding repetitions. Additionally, the class provides a bridge for applying the existent functions of PHP - metaphone() and soundex().

All methods offer three different possibilities of response: TXT, JSON or PHP array. It returns TXT by default, so if you want a different format, you can pass the additional argument in the method. A few examples will make it clearer:

```
use Linguistics\Phonetics;

require __DIR__ . '/vendor/autoload.php';

$str = 'To be or not to be, that is the question';

Phonetics::symbols($str);
/*
Returns:

[ to ] => /ˈtu/, /tə/, /tɪ/
[ be ] => /ˈbi/, /bi/
[ or ] => /ˈɔɹ/, /ɝ/
[ not ] => /ˈnɑt/
[ that ] => /ˈðæt/, /ðət/
[ is ] => /ˈɪz/, /ɪz/
[ the ] => /ˈðə/, /ðə/, /ði/
[ question ] => /ˈkwɛstʃən/, /ˈkwɛʃən/
*/

Phonetics::soundex($str);
/*
Returns:

[ to ] => T000
[ be ] => B000
[ or ] => O600
[ not ] => N300
[ that ] => T300
[ is ] => I200
[ the ] => T000
[ question ] => Q235
*/
Phonetics::metaphone($str);
/*
Returns:

[ to ] => T
[ be ] => B
[ or ] => OR
[ not ] => NT
[ that ] => 0T
[ is ] => IS
[ the ] => 0
[ question ] => KSXN
*/

Phonetics::symbols($str, 'array');
/*
Returns:

array(8) { ["to"]=> array(3) { [0]=> string(6) "/ˈtu/" [1]=> string(6) " /tə/" [2]=> string(6) " /tɪ/" } ["be"]=> array(2) { [0]=> string(6) "/ˈbi/" [1]=> string(5) " /bi/" } ["or"]=> array(2) { [0]=> string(8) "/ˈɔɹ/" [1]=> string(5) " /ɝ/" } ["not"]=> array(1) { [0]=> string(8) "/ˈnɑt/" } ["that"]=> array(2) { [0]=> string(9) "/ˈðæt/" [1]=> string(8) " /ðət/" } ["is"]=> array(2) { [0]=> string(7) "/ˈɪz/" [1]=> string(6) " /ɪz/" } ["the"]=> array(3) { [0]=> string(8) "/ˈðə/" [1]=> string(7) " /ðə/" [2]=> string(6) " /ði/" } ["question"]=> array(2) { [0]=> string(15) "/ˈkwɛstʃən/" [1]=> string(14) " /ˈkwɛʃən/" } }
*/

Phonetics::symbols($str, 'json');
/*
Returns:

string(410) "{"to":["\/\u02c8tu\/"," \/t\u0259\/"," \/t\u026a\/"],"be":["\/\u02c8bi\/"," \/bi\/"],"or":["\/\u02c8\u0254\u0279\/"," \/\u025d\/"],"not":["\/\u02c8n\u0251t\/"],"that":["\/\u02c8\u00f0\u00e6t\/"," \/\u00f0\u0259t\/"],"is":["\/\u02c8\u026az\/"," \/\u026az\/"],"the":["\/\u02c8\u00f0\u0259\/"," \/\u00f0\u0259\/"," \/\u00f0i\/"],"question":["\/\u02c8kw\u025bst\u0283\u0259n\/"," \/\u02c8kw\u025b\u0283\u0259n\/"]}"
*/
```

NYSIIS encoding
---------------

[](#nysiis-encoding)

From v1.1.0, the Phonetics class was reinforced with an additional method which returns The New York State Identification and Intelligence System Phonetic Code, or NYSIIS, to every single word in a sentence (excluding repeated words). The use follows the same logic of the previous static methods.

```
Phonetics::nysiis($str);
/*
Returns:

[ to ] => T
[ be ] => B
[ or ] => AR
[ not ] => NAT
[ that ] => THAT
[ is ] => A
[ the ] => TH
[ question ] => GAASTAAN
*/
```

Underway
========

[](#underway)

Three other classes are currently underway:

- An encoding class for Caverphone algorithm, versions 1.0 and 2.0
- An encoding class for Match Rating Approach comparison and string encoding implementation.
- An interesting legacy encoding on Arpabet algorithm
- Roger Root encoding?

The next stable version, 1.2.0, should already bring the Caverphone class, at least compatible for encoding the 1.0 version of this algorithm.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~2 days

Total

2

Last Release

1875d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13c91dcf5209989038da335ba42538fa84670bf27400f220d182a76e0a720b74?d=identicon)[carloswph](/maintainers/carloswph)

---

Top Contributors

[![meuppt](https://avatars.githubusercontent.com/u/37983141?v=4)](https://github.com/meuppt "meuppt (9 commits)")[![carloswph](https://avatars.githubusercontent.com/u/78516217?v=4)](https://github.com/carloswph "carloswph (3 commits)")

---

Tags

algorithmencodingipa-phonetic-symbolsmetaphonenysiisphoneticsphonixsoundexlanguageAlgorithmipasoundexnysiismetaphoneenglish grammarPhonetics

### Embed Badge

![Health badge](/badges/carloswph-linguistics/health.svg)

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

###  Alternatives

[phpoption/phpoption

Option Type for PHP

2.7k541.2M158](/packages/phpoption-phpoption)[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[patrickschur/language-detection

A language detection library for PHP. Detects the language from a given text string.

8513.2M18](/packages/patrickschur-language-detection)[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.3M7](/packages/wapmorgan-morphos)[coderello/laravel-nova-lang

Language support for Laravel Nova.

4251.2M2](/packages/coderello-laravel-nova-lang)[snipe/banbuilder

Library to easily handle profanity filtering in PHP projects.

3371.5M3](/packages/snipe-banbuilder)

PHPackages © 2026

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