2017 © Pedro Peláez
 

yii2-extension yii2-transliterator-helper

The transliterator helper for the Yii 2 framework

image

sbs/yii2-transliterator-helper

The transliterator helper for the Yii 2 framework

  • Saturday, June 10, 2017
  • by koftikes
  • Repository
  • 1 Watchers
  • 0 Stars
  • 120 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

Transliterator Helper for Yii 2

Build Status, (*1)

Transliterator Helper transliterates UTF-8 encoded text to US-ASCII., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

composer require sbs/yii2-transliterator-helper

or add, (*5)

"sbs/yii2-transliterator-helper": "*"

to the require section of your application's composer.json file., (*6)

Usage

Pass to the method process() the UTF-8 encoded string you wish to transliterate:, (*7)

use sbs\helpers\TransliteratorHelper;

// will echo AAAAAAAECEEEEIIIIDNOOOOOUUUUYssaaaaaaaeceeeeiiiidnooooouuuuyy
TransliteratorHelper::process('ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ', 'en'));

You can use it as application behavior:, (*8)

use sbs\behaviors\SlugBehavior;

//...
public function behaviors()
{
    return [
        //...
        [
            'class' => SlugBehavior::class,
            'attribute' => 'title',
            'slugAttribute' => 'slug',
        ],
    ];
}

Since version 0.3 you can use SlugInput widget:

Configurations:, (*9)

You need a registration controller in your main config file in section controllerMap:, (*10)

use sbs\controllers\TransliterationController;

//...
'controllerMap' => [
    'transliteration' => [
        'class' => TransliterationController::class,
        'lowercase' => false //provides transliteration to lower case, true by default.
    ]
],
//...

Like a widget:, (*11)

use sbs\widgets\SlugInput;

echo SlugInput::widget([
    'name' => 'News[slug]',
    'sourceName' => 'News[title]'
]);

Like an ActiveForm widget:, (*12)

use sbs\widgets\SlugInput;

echo $form->field($model, 'slug')->widget(SlugInput::class, [
    'sourceAttribute' => 'title'
]);

That's all. Enjoy., (*13)

The Versions

10/06 2017

dev-master

9999999-dev https://github.com/koftikes/yii2-transliterator-helper

The transliterator helper for the Yii 2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

extension helper yii transliterator

10/06 2017

0.2.1

0.2.1.0 https://github.com/koftikes/yii2-transliterator-helper

The transliterator helper for the Yii 2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

extension helper yii transliterator

01/01 2017

0.2.0

0.2.0.0 https://github.com/koftikes/yii2-transliterator-helper

The transliterator helper for the Yii 2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

extension helper yii transliterator

17/01 2014

0.1.0

0.1.0.0

Transliterator Helper for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension helper yii transliterator