|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2018-11-26 (1 year ago) ||Not yet rated by the users||Total: 132 ||All time: 8,951 This week: 286|
This class can format files in terms of B, KB, MB, GB, TB.
It can take a number of bytes and returns a formatted string it so it is easier to read by humans.
The class can format the number with options that allow to configure several details like the number of decimal places that may be returned, show a space between the formatted number and the size suffix, or to return the suffix with one or two letters.
prettysize was created by, and is maintained by Ankit Jain, and is a helper utility to provide pretty printed file sizes.
Installation & Usage
> Requires PHP 7.1+
Require prettysize using Composer:
composer require ankitjain28may/prettysize
Pretty::pretty($size, $nospace, $one, $places);
$size : Size in bytes to be converted (Required)
$nospace : Remove space from the output (Default - false)
$one : Single character for the size (Default - false)
$places : Number of decimal places to return (Default - 1)
$size = Pretty::pretty(1024);
// $size = "1.0 kB"
$size = Pretty::pretty(1024, true, true, 2);
// $size = "1.00k"
$size = Pretty::pretty(1024, ['nospace' => true, 'one' => true, 'places' => 5]);
// $size = "1.00000k"
Thank you for considering to contribute to prettysize.
You can also follow the twitter account for latest announcements or just come say hi!: @ankitjain28may
prettysize is an open-sourced library licensed under the MIT license.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.