Download the PHP package wossnap/amharic-transliteration without Composer
On this page you can find all versions of the php package wossnap/amharic-transliteration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package amharic-transliteration
wossnap/amharic-transliteration
A Laravel package for transliterating Amharic (Ethiopic) text to Latin and handling phonetically equivalent character variants.
Amharic has several characters that share the same sound — for example አ, ዓ, ኣ, and ዐ are all pronounced the same way. This package maps every character to its Latin phonetic equivalent and provides tools to work with those variants in search, speech recognition, and admin interfaces.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
Installation
Laravel auto-discovers the service provider. No manual registration needed.
Quick start
You can also inject the service directly:
API reference
Core transliteration
transliterate(string $text): string
Transliterate a full Amharic string to its Latin phonetic equivalent. Non-Amharic characters (spaces, numbers, punctuation) pass through unchanged.
transliterateChar(string $char): ?string
Transliterate a single character. Returns null if the character has no mapping.
Variant handling
getAmharicVariants(string $word): array
Return every possible Amharic spelling of a word by substituting each character with all of its phonetically equivalent alternatives.
getCharEquivalents(string $char): array
Return all Amharic characters that sound identical to the given character. The given character is always included in the result.
areEquivalent(string $charA, string $charB): bool
Check whether two characters share the same sound.
hasVariants(string $char): bool
Check whether a character has at least one phonetically equivalent alternative.
Detection & utility
isAmharic(string $text): bool
Check whether a string contains at least one Amharic character.
splitToChars(string $text): array
Split an Amharic (or mixed) string into individual characters using correct multi-byte handling.
Introspection
getMap(): array
Return the full Amharic → Latin character map as an associative array.
getEquivalenceGroups(): array
Return all defined equivalence groups. Each entry is an array of characters that share the same sound.
Equivalence groups explained
Amharic writing has several homophone families — different characters that represent the same spoken sound. The most common ones this package handles:
| Family | Characters | Sound |
|---|---|---|
| አ / ዐ | አ ኣ ዐ ዓ |
a |
| ሀ / ሐ / ኀ | ሀ ሐ ኀ (and their vowel forms) |
h |
| ሰ / ሠ | ሰ ሠ (and their vowel forms) |
s |
| ጸ / ፀ | ጸ ፀ (and their vowel forms) |
ts |
| ጰ / ፐ | ጰ ፐ (and their vowel forms) |
p |
When you call transliterate(), all characters within a family produce the
same Latin output, so a single transliteration covers all variant spellings.
Publishing config
Publishing the data file (if you need custom mappings)
License
MIT — see LICENSE.