PHP code example of tomchkk / transliterable-bundle

1. Go to this page and download the library: Download tomchkk/transliterable-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tomchkk / transliterable-bundle example snippets


    // config/bundles.php

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

// src/Entity/Person.php

use Doctrine\ORM\Mapping as ORM;

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

// 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();
    }

// 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;
yaml
// config/packages/tomchkk_transliterable.yaml

tomchkk_transliterable:
    global_ruleset:       Any-Latin