https://github.com/xndbogdan/filesize-conversions
Filesize conversions in PHP
https://github.com/xndbogdan/filesize-conversions
conversion conversions converter file laravel package php size
Last synced: about 1 year ago
JSON representation
Filesize conversions in PHP
- Host: GitHub
- URL: https://github.com/xndbogdan/filesize-conversions
- Owner: xndbogdan
- License: mit
- Created: 2022-08-16T06:36:59.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T16:31:19.000Z (over 2 years ago)
- Last Synced: 2025-03-24T08:48:25.088Z (about 1 year ago)
- Topics: conversion, conversions, converter, file, laravel, package, php, size
- Language: PHP
- Homepage:
- Size: 170 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
[
](https://supportukrainenow.org)
# Filesize conversions in PHP
[](https://packagist.org/packages/xndbogdan/filesize-conversions)
[](https://github.com/xndbogdan/filesize-conversions/actions/workflows/run-tests.yml)
[](https://packagist.org/packages/xndbogdan/filesize-conversions)
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:
```bash
composer require xndbogdan/filesize-conversions
```
## Usage
```php
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:
```php
FilesizeConversions::fromFile($yourFilePath)->toKilobytesHuman();
```
Moreover, you can now do quick conversions
```php
FileSizeConversions::quickConvert('megabytes', 'kilobytes', 15);
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Bogdan Mihai](https://github.com/xndbogdan)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.