amneale / byteform
本包最新版本(v1.2.0)没有提供许可证信息。
用于解析字节数量的PHP库
v1.2.0
2022-05-29 10:48 UTC
Requires
- php: ^7.4|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpspec/phpspec: ^7.2
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-08-29 05:44:13 UTC
README
用于解析和格式化字节数量的PHP库
安装
composer require amneale/byteform
用法
解析字节数量
$parser = new \Amneale\ByteForm\ByteParser(); $parser->parseBytes("1.5KB"); // int(1536)
格式化字节数量
$formatter = new \Amneale\ByteForm\ByteFormatter(); $formatter->formatBytes(1536); // "1.50KB" $formatter->formatBytes(1536, 1); // "1.5KB"
贡献
运行测试
byteform 使用 phpspec 驱动开发
make test
修复代码风格
代码风格规则定义在 .php_cs.dist
中。这些规则用于自动修复任何代码风格不一致性
make fmt