xndbogdan/filesize-conversions

Filesize conversions in PHP

v1.1 2022-08-16 09:51 UTC

README

68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f737570706f72742d756b7261696e652e7376673f743d31

Filesize conversions in PHP

Latest Version on Packagist Tests Total Downloads

This is a php plugin that lets you convert filesizes. I'm not sure why would anyone need this, but here it is!

Installation

You can install the package via composer:

composer require xndbogdan/filesize-conversions

Usage

FilesizeConversions::fromBytes(pow(1024, 5))->toPetabytes();

You can also use this package to get a real file's size and convert it to anything, like this:

FilesizeConversions::fromFile($yourFilePath)->toKilobytesHuman();

Moreover, you can now do quick conversions

FileSizeConversions::quickConvert('megabytes', 'kilobytes', 15);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.