burxon/letter-exchange
Laravel/PHP package to transliterate between Cyrillic and Latin alphabets. Convert Cyrillic letters to Latin or Latin back to Cyrillic for consistent slugs, search, and text normalization. Install via Composer: burxon/letter-exchange.
iconv() or Transliterator (ICU) may suffice for basic needs, reducing dependency overhead.LetterExchange) with static methods (toLatin()/toCyrillic()), making integration trivial.Transliterator::createFromRules() or a custom regex solution suffice?привет → privet).composer require burxon/letter-exchange.use Burxon\LetterExchange\LetterExchange;
LetterExchange::toLatin("привет"); // Output: "privet"
app/Services/CyrillicConverter) for dependency injection.class CyrillicConverter {
public function toLatin(string $text): string {
return LetterExchange::toLatin($text);
}
}
unique on transliterated fields).composer.json and test in isolation.ё → yo vs. e).composer.json to avoid breaking changes.regexp_replace).dispatch) to avoid timeouts.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Incorrect transliteration | User confusion, data corruption | Validate against known test cases. |
| Package abandonment | Broken functionality | Fork and maintain locally. |
| Unsupported characters | Crashes or silent failures | Add input sanitization (e.g., preg_replace). |
| Locale-specific rule gaps | Inconsistent behavior | Extend with custom logic. |
toLatin("Привет, мир!")).How can I help you explore Laravel packages today?