aleksender / yii2-morphy
Morphological analyze package for Yii2 Framework based on phpMorphy
Installs: 393
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- aleksender/phpmorphy: ~1.0
- yiisoft/yii2: ~2.0.14
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2024-11-05 06:05:44 UTC
README
Morphological analyze package for Yii2 Framework based on phpMorphy
Installation
To install the library in your project using Composer
, first add the following to your composer.json
config file:
{
"require": {
"aleksender/yii2-morphy": "~1.0"
}
}
Then run Composer's install or update commands to complete installation.
Or you can install from a command line:
composer require aleksender/yii2-morphy
Usage
Completely similar phpMorphy.
$morphy = new \aleksender\morphy\PhpMorphy(); $word = "КОТ"; if ($paradigms = $morphy->findWord($word)) { foreach ($paradigms as $paradigm) { foreach ($paradigm as $form) { echo $form->getWord() . "\n"; } } }
Or you can use like component:
- config/main.php
[ ... 'components' => [ ... 'morphy' => [ 'class' => \aleksender\morphy\PhpMorphy::class, 'lang' => 'ru', ], ... ], ... ]
$morphy = Yii::$app->morphy; $word = "КОТ"; if ($paradigms = $morphy->findWord($word)) { foreach ($paradigms as $paradigm) { foreach ($paradigm as $form) { echo $form->getWord() . "\n"; } } }
You also can see documentation of usage here.