fvozar / twig-ordinal-number-filter
A Twig Extension filter to format number into ordinal form (1st, 2nd, etc.).
Installs: 20 175
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 0
Forks: 0
Open Issues: 1
Requires
- php: >=5.5.9
- ext-intl: *
Requires (Dev)
- phpunit/phpunit: ~4.5
- twig/extensions: ~1.2
This package is not auto-updated.
Last update: 2025-03-30 04:34:59 UTC
README
A Twig Extension filter to format number into ordinal form (1st, 2nd, etc.).
Install
With composer
composer require fvozar/twig-ordinal-number-filter
Usage
Basic usage is just put ordinal filter on your number.
{{ someNumber | ordinal }}
You can also provide another locale for internally used \NumberFormatter class
{{ someNumber | ordinal('sk') }}
For Symfony usage you'll want to add it as a service and tag it for Twig.
# app/config/services.yml services: twig.extension.ordinal: class: Fvozar\Twig\OrdinalNumberExtension tags: - { name: twig.extension }