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)1289MITPHPPHP &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 yesterday

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 57% 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

2319d ago

Major Versions

v1.0.2 → v2.0.02018-11-16

v2.0.0 → v3.0.02019-12-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1112479?v=4)[Natanael Simões](/maintainers/natanaelsimoes)[@natanaelsimoes](https://github.com/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

[symfony/ux-twig-component

Twig components for Symfony

22018.6M356](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1647.0M128](/packages/symfony-ux-live-component)[symfony/ux-toolkit

A tool to easily create a design system in your Symfony app with customizable, well-crafted Twig components

16126.1k1](/packages/symfony-ux-toolkit)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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