Download the PHP package unit/information without Composer
On this page you can find all versions of the php package unit/information. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download unit/information
More information about unit/information
Files in unit/information
Package information
Short Description Package for calculating and formatting information units like Bit, Byte, Kilobit, Kilobyte, Megabit, Megabyte, etc.
License MIT
Homepage http://github.com/michaelKaefer/information
Informations about the package information
information
Package for calculating and formatting information units like Bit, Byte, Kilobit, Kilobyte, Megabit, Megabyte, etc.
Installation
Units
The used units follow the IEC standard.
Name | Abbreviation | In Bit | In Byte | Constant to use |
---|---|---|---|---|
Bit | b | 1 | 0.125 | Unit\Information\Unit::BIT |
Kilobit | kb | 1000 | 125 | Unit\Information\Unit::KILOBIT |
Megabit | Mb | 1000000 | 125000 | Unit\Information\Unit::MEGABIT |
Gigabit | Gb | 1000000000 | 125000000 | Unit\Information\Unit::GIGABIT |
Terabit | Tb | 1000000000000 | 125000000000 | Unit\Information\Unit::TERABIT |
Petabit | Pb | 1000000000000000 | 125000000000000 | Unit\Information\Unit::PETABIT |
Byte | B | 8 | 1 | Unit\Information\Unit::BYTE |
Kilobyte | kB | 8000 | 1000 | Unit\Information\Unit::KILOBYTE |
Megabyte | MB | 8000000 | 1000000 | Unit\Information\Unit::MEGABYTE |
Gigabyte | GB | 8000000000 | 1000000000 | Unit\Information\Unit::GIGABYTE |
Terabyte | TB | 8000000000000 | 1000000000000 | Unit\Information\Unit::TERABYTE |
Petabyte | PB | 8000000000000000 | 1000000000000000 | Unit\Information\Unit::PETABYTE |
Kibibyte | KiB | 8192 | 1024 | Unit\Information\Unit::KIBIBYTE |
Mebibyte | MiB | 8388608 | 1048576 | Unit\Information\Unit::MEBIBYTE |
Gigabyte | GiB | 8589934592 | 1073741824 | Unit\Information\Unit::GIBIBYTE |
Terabyte | TiB | 8796093022208 | 1099511627776 | Unit\Information\Unit::TEBIBYTE |
Pebibyte | PiB | 9007199254740992 | 1125899906842624 | Unit\Information\Unit::PEBIBYTE |
Usage
Intelligent formatting:
Format value in specified unit:
Transform to a number (not a formatted string) value in another unit:
Create a size from a value in a specified unit:
Calculating:
Instantiate from PHP's shorthand values (which do not follow the IEC standard, see https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes):
Development
For some development tools the Symfony binary has to be installed:
Build repo for development:
Testing:
Linting:
License
The MIT License (MIT). Please see License File for more information.