PHP code example of wapmorgan / yii2-inflection

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

    

wapmorgan / yii2-inflection example snippets


  $config = [
    // ...
    'language' => 'ru_RU', // for example, Russian
    // ...
    'components' => [
      // ...
      'inflection' => [
        'class' => 'wapmorgan\yii2inflection\Inflection'
      ]
    ],
    // ...
  ];
  

  $word = 'новость';
  echo Yii::$app->inflection->pluralize(rand(2, 139), $word).PHP_EOL;
  echo Yii::$app->inflection->pluralize(rand(9, 69), $word).PHP_EOL;