PHPackages                             natanaelsimoes/twig-pluralize-extension - 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. natanaelsimoes/twig-pluralize-extension

ActiveLibrary[Templating &amp; Views](/categories/templating)

natanaelsimoes/twig-pluralize-extension
=======================================

Twig extension to output correctly pluralized strings

v3.0.1(6y ago)1241MITPHPPHP &gt;=5.4.0

Since Aug 3Pushed 6y agoCompare

[ Source](https://github.com/natanaelsimoes/twig-pluralize-extension)[ Packagist](https://packagist.org/packages/natanaelsimoes/twig-pluralize-extension)[ Docs](https://github.com/natanaelsimoes/twig-pluralzie-extension/)[ RSS](/packages/natanaelsimoes-twig-pluralize-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (7)Used By (0)

Twig Pluralize
==============

[](#twig-pluralize)

A simple extension for Twig that allows you to pluralize a given string.

Usage
-----

[](#usage)

Register the function at `services.yaml` if your're using Symfony:

```
#[....]
Pluralize:
    class: NatanaelSimoes\Twig\Extension\Pluralize
    tags:
        - twig.extension
```

then reference it in your template:

```
This section has {{ pluralize(categories|length, 'one category', '%d categories', 'no categories') }}.
```

Given the values 0, 1, and 5, the above would output:

```
0: This section has no categories.
1: This section has one category.
5: This section has 5 categories.
```

The last parameter (the "zero items" string) is optional. If omitted, the 3rd parameter (the "many items" string) will be used, as in the following:

```
This section has {{ pluralize(categories|length, 'one category', '%d categories') }}.
```

```
0: This section has 0 categories.
1: This section has one category.
5: This section has 5 categories.
```

The strings are passed through sprintf. You can use the %d token to insert the count into your string, if desired.

Contributing
------------

[](#contributing)

If you have composer install, run `composer install` but if you want to run it in a container, run `docker-[so].sh` or `docker-windows.bat` accordingly to your system.

License &amp; Conduct
---------------------

[](#license--conduct)

This project is licensed under the terms of the MIT License, included in `LICENSE.md`.

All open source Tomodomo projects follow a strict code of conduct, included in `CODEOFCONDUCT.md`. We ask that all contributors adhere to the standards and guidelines in that document.

Thank you!

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 53.3% 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 ~260 days

Recently: every ~323 days

Total

6

Last Release

2266d ago

Major Versions

v1.0.2 → v2.0.02018-11-16

v2.0.0 → v3.0.02019-12-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/c36bd61b716cbfeeede3348b244019a045b340412104be4c4e6c80e9b9146d0c?d=identicon)[natanaelsimoes](/maintainers/natanaelsimoes)

---

Top Contributors

[![natanaelsimoes](https://avatars.githubusercontent.com/u/1112479?v=4)](https://github.com/natanaelsimoes "natanaelsimoes (8 commits)")[![chrisvanpatten](https://avatars.githubusercontent.com/u/1231306?v=4)](https://github.com/chrisvanpatten "chrisvanpatten (7 commits)")

---

Tags

pluraltwigtwig-extension

### Embed Badge

![Health badge](/badges/natanaelsimoes-twig-pluralize-extension/health.svg)

```
[![Health](https://phpackages.com/badges/natanaelsimoes-twig-pluralize-extension/health.svg)](https://phpackages.com/packages/natanaelsimoes-twig-pluralize-extension)
```

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M315](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.2M221](/packages/twig-intl-extra)[twig/string-extra

A Twig extension for Symfony String

21946.0M133](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M162](/packages/symfony-ux-twig-component)[bluetel-solutions/twig-truncate-extension

Twig Extension to truncate nested HTML, safely!

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

PHPackages © 2026

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