PHPackages                             wapmorgan/morphos-twig - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. wapmorgan/morphos-twig

ActiveTwig-extension[Templating &amp; Views](/categories/templating)

wapmorgan/morphos-twig
======================

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

1.6.0(8y ago)1031.6k↓33.3%2[1 issues](https://github.com/wapmorgan/Morphos-Twig/issues)MITPHP

Since Feb 3Pushed 6y ago2 watchersCompare

[ Source](https://github.com/wapmorgan/Morphos-Twig)[ Packagist](https://packagist.org/packages/wapmorgan/morphos-twig)[ RSS](/packages/wapmorgan-morphos-twig/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (0)

MorphosTwig
===========

[](#morphostwig)

[![Latest Stable Version](https://camo.githubusercontent.com/264df0e277f00584052941d718d69449b26589479ecfa8e128c7913f9da04b55/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f6d6f7270686f732d747769672f76657273696f6e)](https://packagist.org/packages/wapmorgan/morphos-twig)[![License](https://camo.githubusercontent.com/0d4192ad6301680bc14407a07409ecbc36fa3b42ed4ca78c83c8472772ba3bbd/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f6d6f7270686f732d747769672f6c6963656e7365)](https://packagist.org/packages/wapmorgan/morphos-twig)

Adds {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

```

{{ 'новость'|plural(252) }} от {{ 'Иванов Иван Иванович'|name('родительный') }}
{{ 'сообщение'|numeral(565, 'n') }} и {{ 123.50|money('₽') }} за Ваше отсутствие
Это Ваше {{ 351|ordinal('n') }} посещение нашего сайта за сегодня!

```

Will be compiled in

```

252 новости от Иванова Ивана Ивановича
пятьсот шестьдесят пять сообщений и 123 рубля 50 копеек за Ваше отсутствие
Это Ваше триста пятьдесят первое посещение нашего сайта за сегодня!

```

Most popular filters:

- `{{ $word|plural($count) }}` - Get plural form of word. Just pass count of objects and noun.

    ```
    {{ 'новость'|plural(251) }}
    ```
- `{{ $value|money($currency) }}` - Get money formatted as text string. Just pass value and currency (₽ or $ or € or ₴ or £).

    ```
    {{ 123.50|money('р') }}
    ```
- `{{ $number|numeral }}` - Get cardinal of a number. Just pass number.

    ```
    {{ 565|numeral }}
    ```
- `{{ $number|ordinal }}` - Get ordinal of a number. Just pass number.

    ```
    {{ 132|ordinal }}
    ```
- `{{ $name|name($case) }}` - Get any case of fullname with gender detection.

    ```
    {{ 'Иванов Иван Иванович'|name('родительный') }}
    ```

Additional filters:

- `{{ $name|name($gender, $case) }}` - Get any case of fullname. Just pass name, gender (`m` or `f` or null) and case (именительный, родительный, дательный, винительный, творительный, предложный).

    ```
    {{ 'Филимонов Игорь|name('m', 'дательный') }}
    ```
- `{{ $number|numeral($gender) }}` - Get numeral of a number. Just pass number and gender (`m` or `f` or `n`) to use correct form of gender-dependent words (один/одно/одна, два/две).

    ```
    {{ 565|numeral('n') }}
    ```
- `{{ $word|numeral($number) }}` - Get numeral with a pluralized word. Just pass number and noun.

    ```
    {{ 'дом'|numeral(221) }}
    ```
- `{{ $word|numeral($number, $gender) }}` - Get numeral with a pluralized word. Just pass number, noun and gender (`m` or `f` or `n`) to use correct form of gender-dependent words (один/одно/одна, два/две).

    ```
    {{ 'сообщение'|numeral(565, 'n') }}
    ```
- `{{ $number|ordinal($gender) }}` - Get ordinal of a number. Just pass number and gender (`m` or `f` or `n`) to use correct form of gender-dependent words (первый/первое/первая, второй/второе/вторая, etc).

    ```
    {{ 'сообщение'|ordinal('n') }}
    ```

Installation
------------

[](#installation)

### Get the Package

[](#get-the-package)

```
composer require wapmorgan/morphos-twig

```

### Register the Service

[](#register-the-service)

Open up your `services.php` in your `app/config` folder, and add the following lines:

```
$container
    ->register('morphos.twig_extension', morphos\MorphosTwigExtension::class)
    ->setPublic(false)
    ->addTag('twig.extension');
```

or if you using Twig separately from Symfony

```
$twig = new Twig_Environment($loader);
$twig->addExtension(new morphos\MorphosTwigExtension());
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~44 days

Total

9

Last Release

3198d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6000618?v=4)[Sergey](/maintainers/wapmorgan)[@wapmorgan](https://github.com/wapmorgan)

---

Top Contributors

[![wapmorgan](https://avatars.githubusercontent.com/u/6000618?v=4)](https://github.com/wapmorgan "wapmorgan (30 commits)")

---

Tags

morphologytwigtwig-extensiontwigtwig-extensionmorphology

### Embed Badge

![Health badge](/badges/wapmorgan-morphos-twig/health.svg)

```
[![Health](https://phpackages.com/badges/wapmorgan-morphos-twig/health.svg)](https://phpackages.com/packages/wapmorgan-morphos-twig)
```

###  Alternatives

[dms/twig-extension-bundle

DMS Twig Extension Bundle, leverages Fabien Potencier's extra twig extensions for your website.

19296.3k](/packages/dms-twig-extension-bundle)[bluetel-solutions/twig-truncate-extension

Twig Extension to truncate nested HTML, safely!

11100.0k](/packages/bluetel-solutions-twig-truncate-extension)[ex3v/formerrorsbundle

A service and Twig method that displays all form errors on all levels.

118.8k](/packages/ex3v-formerrorsbundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
