| 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: 71 | All time:  10,270 This week: 89  | ||||
| Version | License | PHP version | Categories | |||
| readablesize 1.0.0 | MIT/X Consortium ... | 7.2 | PHP 5, Text processing, Conversion | 
| Description | Author | ||||||||||||||||||||||
| This package can convert the size of a file to a readable format. | 
 | ||||||||||||||||||||||
Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it.
Via Composer:
$ composer require ravjanisz/readablesize
// add settings instance
use Rav\Size\SizeSettings;
// add instance
use Rav\Size\Size;
//base for calculation can be added as SizeSettings constructor parameter
//SizeSettings::BINARY or SizeSettings::DECIMAL
$settings = new SizeSettings();
//set precision for size
$settings->setPrecision(2);
//new object instance
$this->size = new Size($settings);
//return '1.46KiB'
echo $this->size->human('1500');
//convert size
//return '0.01TiB'
echo $this->size->convert(Size::MB, Size::TB, '9500');
None
Do you like this project? Support it by donating
<a href="https://www.buymeacoffee.com/ravjanisz">

</a>
readablesize is licensed under the MIT License - see the LICENSE file for details
|  Files (15) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  src (1 directory) | ||||
|  tests (1 directory) | ||||
|    .travis.yml | Data | Auxiliary data | ||
|    clover.xml | Data | Auxiliary data | ||
|    composer.json | Data | Auxiliary data | ||
|    LICENSE | Lic. | License text | ||
|    phpunit.xml | Data | Auxiliary data | ||
|    README.md | Doc. | Documentation | ||
|  Files (15) | / | src | / | Size | 
| File | Role | Description | 
|---|---|---|
|  Size.php | Class | Class source | 
|  SizeException.php | Class | Class source | 
|  SizeFormat.php | Class | Class source | 
|  SizeName.php | Class | Class source | 
|  SizeSettings.php | Class | Class source | 
|  Files (15) | / | tests | / | Size | 
| File | Role | Description | 
|---|---|---|
|  SizeFormatTest.php | Class | Class source | 
|  SizeNameTest.php | Class | Class source | 
|  SizeSettingsTest.php | Class | Class source | 
|  SizeTest.php | Class | Class source | 
| 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.
 If you know an application of this package, send a message to the author to add a link here.