Download the PHP package pnz/twig-extension-number without Composer
On this page you can find all versions of the php package pnz/twig-extension-number. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download pnz/twig-extension-number
More information about pnz/twig-extension-number
Files in pnz/twig-extension-number
Download pnz/twig-extension-number
More information about pnz/twig-extension-number
Files in pnz/twig-extension-number
Vendor pnz
Package twig-extension-number
Short Description A Twig extension for number formatting
License MIT
Homepage https://github.com/thePanz/Twig-Extension-Number
Package twig-extension-number
Short Description A Twig extension for number formatting
License MIT
Homepage https://github.com/thePanz/Twig-Extension-Number
Please rate this library. Is it a good library?
Informations about the package twig-extension-number
Twig-Extension-Number
A Twig extension to handle number formatting.
Included filters:
format_bytes
Formats the given amount as bytes and display it in an as a human-readable format. The filter supports 1000/1024 base counting and formattingformat_grams
Formats the given amount as "grams" in a human-readable formatformat_meters
Formats the given amount as "meters" in a human-readable format
Examples
Display the value of 4000 grams in a human-readable format (4.00 Kg):
The filter allows some customization of the output, given its signature filter_grams(decimals, unityBias)
:
-
Decimals: Display the value of 4000 grams in a human-readable format with 3 decimals (4.000 Kg):
- UnityBias: Set the filter to handle the number as being expressed with a different bias then the standard unit (grams).
To display the value of 4000 (expressed in milligrams,
1E-3
) as grams in a human-readable format with 3 decimals (4.00 g) use:
Install
Via composer:
In Symfony, tag Pnz\TwigExtensionNumber\Number
with twig.extension
, and the filter will be
automatically registered.
All versions of twig-extension-number with dependencies
PHP Build Version
Package Version
The package pnz/twig-extension-number contains the following files
Loading the files please wait ....