Download the PHP package wapmorgan/yii2-inflection without Composer

On this page you can find all versions of the php package wapmorgan/yii2-inflection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-inflection

yii2-inflection

Inflection extension for Yii2. Support for English / Russian languages to inflect words / names / numbers / money / date&time.

Latest Stable Version License Testing

  1. Features
    • Cases
    • Currencies
  2. How does it work
  3. Installation

Features

  1. Pluralize word with number:

    • en: Yii::$app->inflection->pluralize(2, 'item') => 2 items
    • ru: Yii::$app->inflection->pluralize(2, 'элемент') => 2 элемента
  2. Inflect names to relational cases (applicable in Russian only):

    • ru: Yii::$app->inflection->inflectName('Иванов Петр', wapmorgan\yii2inflection\Inflector::DATIVE) => Иванову Петру
    • Description of all supported cases are in Cases section.
  3. Inflect geographical names to relational cases (applicable in Russian only):

    • ru: Yii::$app->inflection->inflectGeoName('Санкт-Петербург', wapmorgan\yii2inflection\Inflector::GENITIVE) => Санкт-Петербурга
  4. Generate cardinal numerals:

    • en: Yii::$app->inflection->cardinalize(2) => 'two'
    • ru: Yii::$app->inflection->cardinalize(2) => 'два'
  5. Generate ordinal numerals:

    • en: Yii::$app->inflection->ordinalize(2) => '2nd'
    • ru: Yii::$app->inflection->ordinalize(2) => '2-й'

    And full form:

    • en: Yii::$app->inflection->ordinalize(2, wapmorgan\yii2inflection\Inflector::FULL) => 'second'
    • ru: Yii::$app->inflection->ordinalize(2, wapmorgan\yii2inflection\Inflector::FULL) => 'второй'
  6. Money to words:

    • (WIP) en: Yii::$app->inflection->monetize(wapmorgan\yii2inflection\Inflector::DOLLAR, 122.04) => 'one hundred twenty-two dollars four cents'
    • ru: Yii::$app->inflection->monetize(wapmorgan\yii2inflection\Inflector::DOLLAR, 122.04) => 'сто двадцать два доллара четыре цента'
    • Description of all supported currencies are in Currencies section.
  7. Data range to words:
    • en: Yii::$app->inflection->textizeTimeRange(new DateInterval('P2Y')) => '2 years'
    • ru: Yii::$app->inflection->textizeTimeRange(new DateInterval('P2Y')) => '2 года'

WIP means Work-in-progress i.e this feature is not supported now, but planned to be implemented.

Cases

Case Russian
Inflector::NOMINATIVE Именительный
Inflector::ABLATIVE Творительный
Inflector::ACCUSATIVE Винительный
Inflector::AVERSIVE
Inflector::BENEFACTIVE
Inflector::CAUSAL
Inflector::COMITATIVE
Inflector::DATIVE Дательный
Inflector::DISTRIBUTIVE
Inflector::GENITIVE Родительный
Inflector::ORNATIVE
Inflector::POSSESSED
Inflector::POSSESSIVE
Inflector::PREPOSITIONAL Предложный
Inflector::PRIVATIVE
Inflector::SEMBLATIVE
Inflector::SOCIATIVE

Currencies

Currency
Inflector::DOLLAR
Inflector::EURO
Inflector::YEN
Inflector::POUND
Inflector::FRANC
Inflector::YUAN
Inflector::KRONA
Inflector::PESO
Inflector::WON
Inflector::LIRA
Inflector::RUBLE
Inflector::RUPEE
Inflector::REAL
Inflector::RAND
Inflector::HRYVNIA

How does it work

It uses built-in inflector for English pluralization (yii\helpers\Inflector) and Morphos for English & Russian on-the-fly inflection (without dictionaries).

Installation

  1. Install extension

  2. Add wapmorgan\yii2inflection\Inflection as a service inflection in config and specify proper target language of your application (web.php or console.php):

    • Optional service parameters:
    • language - default language for inflection. By default, it uses language parameter of current application, but you can change this behavior. Currently supported langs is ru (Russian) and en (English) or their's modification (ru_RU, en_US). If you pass unsupported or unknown language, an Exception will be thrown during service initializion.
    • defaultCurrency - default currency when converting money to words. If set, you can call monetize(float $value) without currency: Yii::$app->inflection->monetize(123.45) => сто двадцать три рубля сорок пять копеек
  3. Call any methods described above in a controller / command / view.

All versions of yii2-inflection with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ^2.0
wapmorgan/morphos Version ~3.2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wapmorgan/yii2-inflection contains the following files

Loading the files please wait ....