Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Letter Exchange

Letter Exchange Laravel Package

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.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Letter Exchange
How do I install burxon/letter-exchange in a Laravel project?
Run `composer require burxon/letter-exchange` in your project directory. The package is dependency-free and integrates seamlessly with Laravel’s autoloader. No additional configuration is required beyond installation.
Does this package support Laravel’s Eloquent models for automatic transliteration?
The package itself doesn’t include Eloquent hooks, but you can easily wrap it in model accessors/mutators. For example, add a `getLatinSlugAttribute` to your model to auto-convert Cyrillic titles to Latin slugs during retrieval.
What Laravel versions does burxon/letter-exchange support?
The package requires PHP 7.4+, which aligns with Laravel 8.x and 9.x. For Laravel 7.x, ensure your PHP version is compatible (7.4+). Test thoroughly if using older versions, as some Laravel features may rely on newer PHP behaviors.
How accurate are the transliteration rules? Does it handle special cases like ‘ё’?
The package uses a basic rule set for Cyrillic-to-Latin conversion, but it lacks explicit documentation on edge cases like ‘ё’ (e.g., ‘yo’ vs. ‘e’). Test with your specific use case—consider forking or extending the package if precision is critical.
Can I use this for bulk database migrations (e.g., converting Cyrillic usernames to Latin)?
Yes, but test performance first. For large datasets, process records in batches to avoid memory issues. Wrap the conversion in a Laravel job or queue worker for better scalability during migrations.
Are there alternatives to burxon/letter-exchange for Cyrillic-Latin conversion?
Yes. PHP’s built-in `Transliterator` (ICU extension) or `iconv` can handle basic conversions without extra dependencies. For Laravel, packages like `spatie/laravel-transliteration` offer broader language support but may be overkill for Cyrillic-only needs.
How do I handle unsupported characters (e.g., Arabic, emojis, or mixed scripts)?
The package silently skips unsupported characters. For stricter control, pre-filter input with `preg_match` or extend the `LetterExchange` class to throw exceptions or log warnings for unsupported characters.
Does this package work with Laravel validation rules (e.g., unique constraints on transliterated fields)?
Yes. Use the package in custom validation rules or Eloquent model observers. For example, validate uniqueness on `LetterExchange::toLatin($request->input)` before saving Cyrillic data.
How can I test the transliteration accuracy in my Laravel app?
Write PHPUnit tests comparing known inputs (e.g., Cyrillic test cases) against expected Latin outputs. Use Laravel’s `Assert` methods or a data provider to cover edge cases like mixed scripts, punctuation, and special characters.
What if the package stops being maintained? Can I fork or modify it easily?
The package is simple and dependency-free, making it easy to fork. Clone the repo, update the `LetterExchange` class, and publish your version to Packagist. Document your changes and test thoroughly, especially for locale-specific rules.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity