behat/transliterator
Abandoned PHP transliteration utility (ported from Perl Text-Unidecode). Provides static methods via Behat\Transliterator\Transliterator. Dataset hasn’t been updated since 2016; consider symfony/string, ext-intl Transliterator, or iconv //TRANSLIT.
é → e), fitting niche needs like slug generation or filename sanitization in Laravel. However, it lacks modern features such as locale-aware transliteration, Unicode normalization, or slug-specific optimizations (e.g., hyphenation rules). For Laravel, this conflicts with built-in tools like Str::slug() (powered by symfony/string), which offers superior maintainability and functionality.Behat\Transliterator\Transliterator class is simple but not extensible. Customization requires forking or wrapping, which complicates long-term maintenance.composer require behat/transliterator. No runtime dependencies beyond PHP core.Str::slug() or Str::ascii(). Integration requires manual API calls (no Laravel service provider or facade).symfony/string MIT-licensed).i → ı), German (ß → ss), or other language-specific rules.é vs. e + ´).Str::slug()).IntlTransliterator.ß → ss vs. s)?Str::slug() (for slugs) or Str::ascii() (for ASCII conversion) instead? These are maintained, locale-aware, and integrated with Laravel.symfony/string or IntlTransliterator been benchmarked for this use case?Str::slug() and Str::ascii() provide better functionality (e.g., hyphenation, reserved-word replacement) and active maintenance.symfony/string or IntlTransliterator for consistency and maintainability.iconv, IntlTransliterator).Short-Term (Immediate Use):
use Behat\Transliterator\Transliterator;
$slug = Transliterator::transliterate($title);
Medium-Term (6–12 Months):
Str::slug($title) (Laravel) or StringUtils::slugify() (symfony/string).Transliterator::create('Any-Latin; Latin-ASCII') (ext-intl) or iconv($str, 'ASCII//TRANSLIT).Str::slug() and compare outputs.class TransliteratorAdapter {
public static function transliterate(string $text): string {
return \Behat\Transliterator\Transliterator::transliterate($text);
// Future: Replace with Str::ascii() or IntlTransliterator
}
}
Long-Term (1–2 Years):
Str::slug() or IntlTransliterator. Remove behat/transliterator from composer.json.composer.json or use a polyfill.Str helpers. Recommendation: Align with Laravel’s ecosystem by using Str::slug().composer why behat/transliterator to identify all usages.ß must map to ss").behat/transliterator and alternatives for:
i).if (config('app.use_legacy_transliterator')) {
return \Behat\Transliterator\Transliterator::transliterate($text);
}
return Str::slug($text);
composer.json.How can I help you explore Laravel packages today?