The symfony integration for nodiacritic library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Tests
src
.gitignore
.travis.yml
LICENSE
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

VRiaNoDiacriticBundle

Build Status

The symfony integration for nodiacritic library - tiny library that removes all diacritical signs from characters.

##Installation

Using Composer, run:

composer require vria/nodiacritic-bundle

Add the VRiaNoDiacriticBundle to your application kernel:

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new VRia\Bundle\NoDiacriticBundle\VRiaNoDiacriticBundle(),
        // ...
    );
}

##Use

In controller:

$noDiacriticString = NoDiacritic::filter("Révolution française");

In Twig template:

{{ "Révolution française"|nodiacritic }}

As expected, the result is Revolution francaise.

As you can see nodiacritic library is aware of German and Danish particularities, and so is this integration. The bunble reads current locale from Request and pass it to filter function. In case the desired locale is different you can pass it as a parameter:

Ceci est une phrase allemande sans caractères spéciaux: {{ "Schöne straße"|nodiacritic("de") }}

will print Ceci est une phrase allemande sans caractères spéciaux: Schoene strasse.

You can find the article about the library in my blog.