1tomany/twig-filesize
最新稳定版本:v0.0.1
Composer 安装命令:
composer require 1tomany/twig-filesize
包简介
A Twig extension to render human readable filesizes
关键字:
README 文档
README
This Twig extension allows you to easily convert an integer, in bytes, to a human readable string with the correct unit.
Installation
Install the library with Composer:
composer require 1tomany/twig-filesize
Tag the OneToMany\Twig\FilesizeExtension as a Twig extension in your services configuration:
services: OneToMany\Twig\MailtoExtension: tags: [twig.extension]
Usage
This extension exposes a single filter named filesize with the following arguments:
scale: The number of decimals to display. Thescalemust be between0and4, inclusive, and has a default value of0.spacer: A string that separates the filesize and unit. Thespaceris an empty string by default.
{{ 851856|filesize(1) # 831.9KB }}
{{ 851856|filesize(0, ' ') # 832 KB }}
Testing
./vendor/bin/phpunit
Credits
License
The MIT License
统计信息
- 总下载量: 148
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-15