PHP code example of tinigin / morphos

1. Go to this page and download the library: Download tinigin/morphos 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/ */

    

tinigin / morphos example snippets


// Inflect russian names:
morphos\Russian\inflectName('Иванов Петр', 'родительный') => 'Иванова Петра'

// Inflect geographical names:
morphos\Russian\GeographicalNamesInflection::getCase('Москва', 'родительный') => 'Москвы'

// Pluralize russian nouns and adjectives:
morphos\Russian\pluralize(10, 'новый дом') => '10 новых домов'

// Generate russian cardinal numerals:
morphos\Russian\CardinalNumeralGenerator::getCase(567, 'именительный') => 'пятьсот шестьдесят семь'

// Generate russian ordinal numerals:
morphos\Russian\OrdinalNumeralGenerator::getCase(961, 'именительный') => 'девятьсот шестьдесят первый'

// Generate russian time difference
morphos\Russian\TimeSpeller::spellDifference(time() + 3600, morphos\TimeSpeller::DIRECTION) => 'через 1 час'

// other functions described in README-ru.md

// Pluralize english nouns:
morphos\English\pluralize(10, 'house') => '10 houses'

// Generate english cardinal numerals:
morphos\English\CardinalNumeralGenerator::generate(567) => 'five hundred sixty-seven'

// Generate english ordinal numerals:
morphos\English\OrdinalNumeralGenerator::generate(961) => 'nine hundred sixty-first'

// Generate english time difference
morphos\English\TimeSpeller::spellDifference(time() + 3600, morphos\TimeSpeller::DIRECTION) => 'in 1 hour'