PHPackages                             rauwebieten/twig-humanizer-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. rauwebieten/twig-humanizer-extension

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

rauwebieten/twig-humanizer-extension
====================================

Twig extension for the coduo/php-humanizer library

v1.0(7y ago)0478PHP

Since Jan 15Pushed 7y ago1 watchersCompare

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

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

Twig Humanizer Extension
========================

[](#twig-humanizer-extension)

[![Build Status](https://camo.githubusercontent.com/5b8035a8fdf763da3692caaafd27c914dc5e146f14718b1ddd5a43ebc9b76f53/68747470733a2f2f7472617669732d63692e6f72672f726175776562696574656e2f747769672d68756d616e697a65722d657874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rauwebieten/twig-humanizer-extension)[![Maintainability](https://camo.githubusercontent.com/2c244778d0afdadc67702abd3d0dc5cc140f62c83c56140406ecef8b92902371/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35313433653366356232306635376133303834642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/rauwebieten/twig-humanizer-extension/maintainability)[![codecov](https://camo.githubusercontent.com/e50e97e1d51a2c85e5f96aab8056d4d3f292336d6f7ca4b99b9cac1429089a9b/68747470733a2f2f636f6465636f762e696f2f67682f726175776562696574656e2f747769672d68756d616e697a65722d657874656e73696f6e2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/rauwebieten/twig-humanizer-extension)[![StyleCI](https://camo.githubusercontent.com/0b59618a1feb17f398749cae15558c24d9feaa58558bf836555d2f265fd02d0b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136353838393036372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/165889067)[![](https://camo.githubusercontent.com/69a520cd3a0e52ab3a677b0df3f6da4fba5cef68bcd80b7d68287adcb4ccc9de/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f726175776562696574656e2f747769672d68756d616e697a65722d657874656e73696f6e2e737667)](https://camo.githubusercontent.com/69a520cd3a0e52ab3a677b0df3f6da4fba5cef68bcd80b7d68287adcb4ccc9de/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f726175776562696574656e2f747769672d68756d616e697a65722d657874656e73696f6e2e737667)[![](https://camo.githubusercontent.com/284a8e5055d5a4f45db9b120ba3e5ca54af8edc1f0de5d720c382b73adddf6c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726175776562696574656e2f747769672d68756d616e697a65722d657874656e73696f6e2e737667)](https://camo.githubusercontent.com/284a8e5055d5a4f45db9b120ba3e5ca54af8edc1f0de5d720c382b73adddf6c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726175776562696574656e2f747769672d68756d616e697a65722d657874656e73696f6e2e737667)

A [Twig extension](https://github.com/twigphp/Twig)for the [PHP Humanizer library](https://github.com/coduo/php-humanizer)

Use the humanizer functions from the coduo/php-humanizer library in your Twig templates.

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

[](#installation)

```
composer require rauwebieten/twig-humanizer-extension

```

Available filters
-----------------

[](#available-filters)

All filters are underscored, and prefixed:

- humanizer\_humanize
- humanizer\_truncate
- humanizer\_truncate\_html
- humanizer\_ordinalize
- humanizer\_ordinal
- humanizer\_to\_roman
- humanizer\_from\_roman
- humanizer\_binary\_suffix
- humanizer\_precise\_binary\_suffix
- humanizer\_metric\_suffix
- humanizer\_metric\_suffix
- humanizer\_oxford
- humanizer\_difference
- humanizer\_precise\_difference

See the [PHP Humanizer documentation](https://github.com/coduo/php-humanizer) for details.

Example usage
-------------

[](#example-usage)

```

    1 to 12 in roman:
    {% for i in 1..12 %}
        {{ i|humanizer_to_roman }}
    {% endfor %}

    Roman VI = {{ 'VI'|humanizer_from_roman }}

    1024 bytes = {{ 1024|humanizer_binary_suffix }}
    1024 bytes = {{ 1024|humanizer_precise_binary_suffix(2) }}

    This article was posted
    {{ date("now")|humanizer_difference(date("2014-04-24")) }}

    {{ ['Michal', 'Norbert', 'Lukasz', 'Pawel']|humanizer_oxford(2) }}

    1240 metric = {{ 1240|humanizer_metric_suffix }}

    first: 1{{ 1|humanizer_ordinal }}
    first: {{ 1|humanizer_ordinalize }}

    {{ 'Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc.'|humanizer_truncate(8,'...') }}

{{ 'HyperText Markup Language, commonly referred to as HTML'|humanizer_truncate_html(3)|raw }}
{{ 'HyperText Markup Language, commonly referred to as HTML'|humanizer_truncate_html(3,'')|raw }}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

2674d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59acbf4a62b72eba36a902011e336653854d735158432c0c3b382d95b4236589?d=identicon)[rauwebieten](/maintainers/rauwebieten)

---

Top Contributors

[![peter-kinamo](https://avatars.githubusercontent.com/u/20679429?v=4)](https://github.com/peter-kinamo "peter-kinamo (9 commits)")[![rauwebieten](https://avatars.githubusercontent.com/u/11740475?v=4)](https://github.com/rauwebieten "rauwebieten (9 commits)")

---

Tags

humanizerphptwigtwig-extension

### Embed Badge

![Health badge](/badges/rauwebieten-twig-humanizer-extension/health.svg)

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

###  Alternatives

[twig/intl-extra

A Twig extension for Intl

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

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[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)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)

PHPackages © 2026

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