承接 1tomany/twig-filesize 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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. The scale must be between 0 and 4, inclusive, and has a default value of 0.
  • spacer: A string that separates the filesize and unit. The spacer is 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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-15