Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 143 | All time: 9,173 This week: 488 |
Version | License | PHP version | Categories | |||
prettysize 1.0.0 | MIT/X Consortium ... | 7.1 | Files and Folders, Text processing, P... |
Description | Author | |||||||||||||||||||||||
This class can format files in terms of B, KB, MB, GB, TB. |
|
prettysize was created by, and is maintained by Ankit Jain, and is a helper utility to provide pretty printed file sizes.
> 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)
*/
use Ankitjain28may\Prettysize\Pretty;
$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.
Files (10) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file) | ||||
tests (1 file) | ||||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
coverage.xml | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
ruleset.xml | Data | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.