PHP code example of artarts36 / morpher

1. Go to this page and download the library: Download artarts36/morpher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

artarts36 / morpher example snippets


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());

$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));
});