Skip to content

slawap/yii2-morpher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yii2-morpher

Installation

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock available

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist slawap/yii2-morpher

or add

"slawap/yii2-morpher": "*"

to the require section of your composer.json.

Usage

'components' => [
   // ...
    'morpher' => [
        'class' => 'slawap\morpher\Morpher'
    ]
    // ...
 ]

Get all case;

    Yii::$app->morpher
        ->setQuery('Санкт-Петербург')
    ->getData();

     /*result 
     Array
     (
         [Р] => Санкт-Петербурга
         [Д] => Санкт-Петербургу
         [В] => Санкт-Петербург
         [Т] => Санкт-Петербургом
         [П] => Санкт-Петербурге
         [множественное] => Array
             (
                 [И] => Санкт-Петербурги
                 [Р] => Санкт-Петербургов
                 [Д] => Санкт-Петербургам
                 [В] => Санкт-Петербурги
                 [Т] => Санкт-Петербургами
                 [П] => Санкт-Петербургах
             )
     
     ); */

Get case;

    echo Yii::$app->morpher
        ->setQuery('Санкт-Петербург')
        ->setCase(Morpher::PREPOSITIONAL)
    ->getData();
    //result 'Санкт-Петербурге'

Get plural case;

    echo Yii::$app->morpher
        ->setQuery('Санкт-Петербург')
        ->setCase(Morpher::PREPOSITIONAL)
        ->setPlural()
    ->getData();
    
    //result Санкт-Петербургах

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%