You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if no options key or null value specified, default options will be used
59
+
// to use common options from this config, specify []
60
+
'options' => [],
61
+
// when null specified, default morphy dicts path will be used
62
+
'dicts_path' => null,
63
+
],
64
+
],
58
65
];
59
66
```
60
67
61
68
## Usage
62
69
70
+
Wrapper automatically prepares input word for phpMorphy: it applies `trim` to word and converts it to uppercase or lowercase, depending on the dictionary options.
71
+
63
72
Using the wrapper directly:
64
73
65
74
```php
66
75
use SEOService2020\Morphy\Morphy;
67
76
$morphy = new Morphy(Morphy::englishLang);
68
-
echo $morphy->getPseudoRoot('FIGHTY');
77
+
echo $morphy->getPseudoRoot('fighty');
69
78
```
70
79
71
80
Or via Laravel Facade:
72
81
73
82
```php
74
-
use SEOService2020\Morphy\Facade\Morphy;
75
-
Morphy::getPseudoRoot('БОЙЦОВЫЙ');
83
+
use SEOService2020\Morphy\Facade\Morphy as Morphies;
84
+
// first parameter is the name of morphy in config
85
+
Morphies::getPseudoRoot('ru', 'Бойцовый');
86
+
87
+
// get morphy and call methods in regular manner
88
+
Morphies::morphy('ru')->lemmatize(' бойцовый'); // word will be trimmed
89
+
90
+
// get all morphies, returns array like ['name' => Morphy]
91
+
Morphies::morphies();
92
+
93
+
// get all morphies with pecific locale, returns array like ['name' => Morphy]
94
+
Morphies::morphies(Morphy::russianLang);
95
+
96
+
// you can call phpMorphy static methods as well
97
+
Morphies::getDefaultDictsDir();
76
98
```
77
99
100
+
Note:
101
+
> You can access morphy properties only directly from morphy object, not facade.
102
+
78
103
### Add facade support
79
104
80
105
This package allows Laravel to support facade out of the box, but you may explicitly add facade support to config/app.php:
0 commit comments