dev-master
9999999-dev https://github.com/SevenFloor/yii2-morpherYii2 Morpher
MIT
The Requires
- php >=5.4.0
- yiisoft/yii2 *
- yiisoft/yii2-httpclient ^2.0
by Andrei Arkhipov
yii2 yii yii 2 cases morpher
Wallogit.com
2017 © Pedro Peláez
Yii2 Morpher
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
composer require --prefer-dist sevenfloor/yii2-morpher
or add, (*4)
"sevenfloor/yii2-morpher": "*"
to the require section of your composer.json., (*5)
## Usage, (*6)
php
'components' => [
// ...
'morpher' => [
'class' => 'sevenfloor\morpher\Morpher'
]
// ...
], (*7)
Get all case; ```php Yii::$app->morpher ->setQuery('Санкт-Петербург') ->getData();, (*8)
/*result
Array
(
[Р] => Санкт-Петербурга
[Д] => Санкт-Петербургу
[В] => Санкт-Петербург
[Т] => Санкт-Петербургом
[П] => Санкт-Петербурге
[множественное] => Array
(
[И] => Санкт-Петербурги
[Р] => Санкт-Петербургов
[Д] => Санкт-Петербургам
[В] => Санкт-Петербурги
[Т] => Санкт-Петербургами
[П] => Санкт-Петербургах
)
); */
```, (*9)
Get case;
php
echo Yii::$app->morpher
->setQuery('Санкт-Петербург')
->setCase(Morpher::PREPOSITIONAL)
->getData();
//result 'Санкт-Петербурге', (*10)
Get plural case; ```php echo Yii::$app->morpher ->setQuery('Санкт-Петербург') ->setCase(Morpher::PREPOSITIONAL) ->setPlural() ->getData();, (*11)
//result Санкт-Петербургах
```, (*12)
Yii2 Morpher
MIT
yii2 yii yii 2 cases morpher