aschmelyun/size
Composer 安装命令:
composer require aschmelyun/size
包简介
Simple PHP helper to convert bytes to different sizes
README 文档
README
🧮 A super simple helper package for converting between different byte units.
composer require aschmelyun/size
Requirements
- PHP 7.4 or higher
Usage
Instantiate the class with the data unit you're bringing in. By default, it'll return back the value in bytes. You can then tack on either a method or a property to convert that unit into a different one.
use Aschmelyun\Size\Size; $bytesInTwoMegabytes = Size::MB(2); // 2097152 $gigabytesInTwoMegabytes = Size::MB(2)->toGB(); // 0.001953125 $kilobytesInTwoMegabytes = Size::MB(2)->KB; // 2048
That's it!
The available properties are: B, KB, MB, GB, TB, PB, EB, ZB, YB
Tests
Size comes with a small suite of tests powered by Pest. To run them, clone this repository and then use:
./vendor/bin/pest
Contact Info
Have an issue? Submit it here! Want to get in touch or recommend a feature? Feel free to reach out to me on Twitter for any other questions or comments.
License
The MIT License (MIT). See LICENSE.md for more details.
aschmelyun/size 适用场景与选型建议
aschmelyun/size 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.22k 次下载、GitHub Stars 达 47, 最近一次更新时间为 2022 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aschmelyun/size 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aschmelyun/size 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 47
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-19