|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not yet rated by the users||Total: 68 ||All time: 10,077 This week: 326|
This package can convert the size of a file to a readable format.
It takes a string that contains a number of bytes of size of a given file and returns a string that represents that number in a more human readable format using suffixes for KB, MB, TB, etc..
The package allows configuring the number of decimal digits to be used as precision when rounding the number to be formatted.
Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it.
PHP >= 7.1
(optional) PHPUnit to run tests.
$ composer require ravjanisz/readablesize
// add settings instance
// add instance
//base for calculation can be added as SizeSettings constructor parameter
//SizeSettings::BINARY or SizeSettings::DECIMAL
$settings = new SizeSettings();
//set precision for size
//new object instance
$this->size = new Size($settings);
echo $this->size->convert(Size::MB, Size::TB, '9500');
Support the development
Do you like this project? Support it by donating
readablesize is licensed under the MIT License - see the LICENSE file for details
||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.