artarts36 / morpher
Morpher
1.0.3
2020-10-13 21:00 UTC
Requires
- guzzlehttp/guzzle: >=6.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-12-14 05:57:07 UTC
README
Morpher API [Only Russian]
Library for working with API http://morpher.ru/ws3/
Installation
composer require artarts36/morpher
Usage
- Simple
use ArtARTs36\Morpher\Client; use ArtARTs36\Morpher\Morpher; $morpher = new Morpher(new Client(new \GuzzleHttp\Client())); var_dump($morpher->declineNoun('Человек')->accusative()); var_dump($morpher->declineAdjective('Приветливый')->male()); var_dump($morpher->declineDate('2020-10-13')->prepositional())); var_dump($morpher->declineDate(new DateTime())->dative());
- Binding in Laravel
in bootstrap/app.php
$app->singleton(\ArtARTs36\Morpher\Contracts\Client::class, function () { return new ArtARTs36\Morpher\Client(new \GuzzleHttp\Client()); }); $app->singleton(\ArtARTs36\Morpher\Contracts\Morpher::class, function () use ($app) { return new ArtARTs36\Morpher\Morpher($app->get(\ArtARTs36\Morpher\Contracts\Client::class)); });