PHPackages                             tomchkk/transliterable-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. tomchkk/transliterable-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

tomchkk/transliterable-bundle
=============================

A Symfony bundle providing an embeddable class, `Transliterable`, to enable mapping of a Doctrine entity field to `\_original` and `\_transliteration` columns within an entity.

v1.0.0(7y ago)234MITPHPPHP ^7.1.3

Since Dec 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/tomchkk/transliterable-bundle)[ Packagist](https://packagist.org/packages/tomchkk/transliterable-bundle)[ RSS](/packages/tomchkk-transliterable-bundle/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (11)Versions (2)Used By (0)

[![GitHub Release](https://camo.githubusercontent.com/5c78b8e77a8816feea17c0646de3c1f985edbfeab1e21ca5490b05b087677689/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f746f6d63686b6b2f7472616e736c6974657261626c652d62756e646c652f616c6c2e737667)](https://github.com/tomchkk/transliterable-bundle/releases)[![Travis](https://camo.githubusercontent.com/8998f352c53553937b78039e1d2a213861eca11f805319fb1af70d023a0cb682/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d63686b6b2f7472616e736c6974657261626c652d62756e646c652e737667)](https://travis-ci.org/tomchkk/transliterable-bundle)[![Total Downloads](https://camo.githubusercontent.com/4f34824564a5259e3f9485fce3b08ceb6872dfbf971bc8ea43931176a2ed1931/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d63686b6b2f7472616e736c6974657261626c652d62756e646c652e737667)](https://packagist.org/packages/tomchkk/transliterable-bundle)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

TransliterableBundle
====================

[](#transliterablebundle)

A Symfony bundle to facilitate the transliteration of Doctrine entity string fields.

---

Overview
--------

[](#overview)

TransliterableBundle provides an [embeddable](https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/tutorials/embeddables.html) entity, `Transliterable`, to enable mapping of a single Doctrine entity field to corresponding `_original` and `_transliteration` fields.

For example, a Doctrine entity class, `Person`, with a `$firstname` property mapped to the `Transliterable` embedded entity will result in a table with `firstname_original` and `firstname_transliteration` columns.

---

Installation
------------

[](#installation)

1. Require the latest stable version of TransliterableBundle by running the following console command from the root of your Symfony project: > `$ composer require tomchkk/transliterable-bundle`
2. Enable the bundle by adding a reference to it in the array returned by `config/bundles.php`: ```
    // config/bundles.php

    return [
        // ...
        Tomchkk\TransliterableBundle\TomchkkTransliterableBundle::class => ['all' => true],
    ];
    ```

---

Usage
-----

[](#usage)

### Embeddable Entity

[](#embeddable-entity)

An entity field can be made *transliterable* by including a Doctrine `Embedded` annotation with a *class* value of the fully-qualified `Transliterable` class name.

```
// src/Entity/Person.php

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 */
class Person
{
    /**
     * @ORM\Embedded(class="Tomchkk\TransliterableBundle\Embeddable\Transliterable")
     */
    private $firstname;
}
```

For the same reasons indicated in the documentation for Doctrine Embeddables, `Transliterable` [fields should be initialized](https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/tutorials/embeddables.html#initializing-embeddables) to guarantee returning an embedded `Transliterable` instance - e.g.:

```
// src/Entity/Person.php

use Doctrine\ORM\Mapping as ORM;
use Tomchkk\TransliterableBundle\Embeddable\Transliterable;

/**
 * @ORM\Entity()
 */
class Person
{
    public function __construct()
    {
        $this->firstname = new Transliterable();
    }
```

### Transliteration

[](#transliteration)

An embbedded `Transliterable` field with an *original* value but without a *transliteration* value will be transliterated when the entity is first persisted, or when updated.

**Transliterator**

By default TransliterableBundle uses [PHP's built-in Transliterator class](http://php.net/manual/en/class.transliterator.php) - decorated with a simple caching mechanism - as the transliteration engine. The default transliterator can be overridden in configuration by a custom service implementing `Tomchkk\TransliterableBundle\Service\TransliteratorInterface` - e.g.:

```
// config/packages/tomchkk_transliterable.yaml

tomchkk_transliterable:
    transliterator:       App\Service\CustomTransliterator
```

### Rulesets

[](#rulesets)

In order to perform a transliteration the transliterator requires a *ruleset* identifier, which is used to create a particular transliterator instance. [More on ruleset identifiers](http://userguide.icu-project.org/transforms/general#TOC-Transliterator-Identifiers).

**Global ruleset**

The default transliterator provides a ruleset which will be applied to all transliterations if no other ruleset is provided; this default can be overridden by setting the `global_ruleset` value in configuration - e.g.:

```
// config/packages/tomchkk_transliterable.yaml

tomchkk_transliterable:
    global_ruleset:       Any-Latin
```

**Annotation rulesets**

A `Transliterable` annotation is also available to enable a *ruleset* to be set at class- or property-level, the most specific of which will be applied to the transliteration of a field's value, overriding the global ruleset.

```
// src/Entity/Person.php

use Doctrine\ORM\Mapping as ORM;
use Tomchkk\TransliterableBundle\Annotation as Tomchkk;

/**
 * @ORM\Entity()
 * @Tomchkk\Transliterable(ruleset="Any-Latin")
 */
class Person
{
    /**
     * @ORM\Embedded(class="Tomchkk\TransliterableBundle\Embeddable\Transliterable")
     */
    private $firstname;

    /**
     * @ORM\Embedded(class="Tomchkk\TransliterableBundle\Embeddable\Transliterable")
     * @Tomchkk\Transliterable(ruleset="Russian-Latin/BGN; Any-Latin")
     */
    private $lastname;
```

In the above example `$firstname` would be transliterated according by the class ruleset; `$lastname` by the property ruleset.

### Frontend

[](#frontend)

**Form Type**

A `TransliterableType` form type is included, providing an `original` and `transliteration` field - each extending Symfony's [TextType](https://symfony.com/doc/current/reference/forms/types/text.html). By default the `required` option of the `transliteration` field is set to `false` since this field, if empty, will be populated when the entity is persisted.

The following configuration options are available for `TransliterableType`:

OptionTypeDefaultUse`exclude_transliteration`booleanfalseWhether or not to exclude the transliteration field in the form`options`array\[empty\]Standard `TextType` options applicable to both `TransliterableType` fields`original_options`array\[empty\]Standard `TextType` options applicable to just the `original` field`transliteration_options`array\[empty\]Standard `TextType` options applicable to just the `transliteration` field**Twig Extension**

The `transliterate` twig filter enables direct transliteration of strings within twig templates - e.g.:

```
Firstname: {{ 'Илья'|transliterate }}

```

The optional *ruleset* argument can be used per transliteration, otherwise the Transliterator service's `global_ruleset` will be used:

```
Firstname: {{ 'Илья'|transliterate('Russian-Latin/BGN') }}

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2733d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/624c4f6bab3e31a7f022c26be6166a2c362a2d769675f585eda44c07e1693a43?d=identicon)[tomchkk](/maintainers/tomchkk)

---

Top Contributors

[![tomchkk](https://avatars.githubusercontent.com/u/6698306?v=4)](https://github.com/tomchkk "tomchkk (40 commits)")

### Embed Badge

![Health badge](/badges/tomchkk-transliterable-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tomchkk-transliterable-bundle/health.svg)](https://phpackages.com/packages/tomchkk-transliterable-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M373](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1715.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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