承接 aschmelyun/size 相关项目开发

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

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

aschmelyun/size

最新稳定版本:v1.0.0

Composer 安装命令:

composer require aschmelyun/size

包简介

Simple PHP helper to convert bytes to different sizes

README 文档

README

Current Version License Total Downloads

🧮 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.

统计信息

  • 总下载量: 1.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 47
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-19