Downloadobjectsize
 
  
Converts file or directory to human readable number by taking the number of that unit that the bytes will go into it. 
Requirements
- 
PHP >= 7.1
 
- 
ravjanisz/readablesize
 
- 
(optional) PHPUnit to run tests.
 
 
Install
Via Composer: 
$ composer require ravjanisz/objectsize
 Usage
//settings and object instance
use Rav\Size\SizeSettings;
use Rav\ObjectSize\ObjectSize;
//create settings for human readable size
$settings = new SizeSettings();
$settings->setPrecision(2);
//create object instance
$object = new ObjectSize($settings);
//set file/dir path
$object->setPath(__DIR__ . '/files/shark.jpeg');
//get value
echo $object->human();
//get value in bytes
echo $object->inBytes();
//set file/dir path
$object->setPath(__DIR__ . '/files');
//get value
echo $object->human();
//get value in bytes
echo $object->inBytes();
 
Documentation
None 
Support the development
Do you like this project? Support it by donating 
<a href="https://www.buymeacoffee.com/ravjanisz"> 
  
</a> 
License
objectsize is licensed under the MIT License - see the LICENSE file for details  
 |