ravjanisz / objectsize
objectsize
dev-master
2019-10-22 18:38 UTC
Requires
- php: >=7.1
- ravjanisz/readablesize: *
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2025-06-29 01:41:13 UTC
README
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
License
objectsize is licensed under the MIT License - see the LICENSE file for details