oskarstark / readable-filesize-extension
A Twig extension to convert filesize to human readable string
Installs: 212 394
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- twig/twig: ^2.6 || ^3.0
- webmozart/assert: ^1.11
Requires (Dev)
- ergebnis/test-util: ^1.4
- friendsofphp/php-cs-fixer: ^2.18.3
- phpstan/phpstan: ^0.12.82
- phpunit/phpunit: ^8.5 || ^9.0
README
A Twig extension to convert filesize to human readable string.
Installation
composer require oskarstark/readable-filesize-extension
# config/services.yaml services: OskarStark\Twig\ReadableFilesizeExtension: tags: ['twig.extension']
Usage
// file.size = 1024 {{ file.size|readable_filesize() }} # prints '1 KB' {{ file.size|readable_filesize(2) }} # prints '1.00 KB'