anteris-dev/units-of-information-helper

There is no license information available for the latest version (dev-main) of this package.

A Byte-Sized Package for your Units of Information Conversion

dev-main 2021-04-16 21:29 UTC

This package is auto-updated.

Last update: 2024-10-17 05:30:11 UTC


README

Tests Check & fix styling

Okay, we lied... it's 14.8 Megabytes, but it's sooo worth it.

To Install

composer require anteris-dev/units-of-information-helper:dev-master

About

This package helps convert units of information (Bits, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, etc.) to other units of information and readable strings.

Example: Gigabytes to Megabytes

use Anteris\Helper\UnitsOfInformation\Gigabyte;
use Anteris\Helper\UnitsOfInformation\Megabyte;

Gigabyte::toMegabyte(2); // 2048

// OR

Megabyte::fromGigabyte(2); // 2048

Example: Human Readable String

use Anteris\Helper\UnitsOfInformation\Kilobyte;
use Anteris\Helper\UnitsOfInformation\Human;

// Outputs: 1.00 MB
echo Human::megabyte(
    Kilobyte::toMegabyte(1028)
);