Skip to content

Simple function formatBytes() that you all heard about and implemented - now in packagist. Easily convert filesizes from bytes to human-readable format

License

Notifications You must be signed in to change notification settings

LeTraceurSnork/format-bytes

Repository files navigation

format-bytes

Simple function formatBytes() that you all heard about and implemented - now in packagist

Installation

Composer installation:

composer require letraceursnork/format-bytes

Usage

use LTS\FormatBytes\Formatter;

$formatter = new Formatter();
$formatter = new Formatter([' bytes suffix', ' KBytes suffix', ' MBytes suffix', 'etc...']);
$bytes = 2048;
$result = $formatter->formatBytes($bytes, $optional_precision);
echo $result; // 2 KBytes suffix

About

Simple function formatBytes() that you all heard about and implemented - now in packagist. Easily convert filesizes from bytes to human-readable format

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages