sevenfloor / yii2-morpher
Yii2 Morpher
Installs: 69
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-component
Requires
- php: >=5.4.0
- yiisoft/yii2: *
- yiisoft/yii2-httpclient: ^2.0
This package is not auto-updated.
Last update: 2024-11-10 03:03:59 UTC
README
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist sevenfloor/yii2-morpher
or add
"sevenfloor/yii2-morpher": "*"
to the require
section of your composer.json.
Usage
'components' => [ // ... 'morpher' => [ 'class' => 'sevenfloor\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 Санкт-Петербургах