Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.63 KB

README.md

File metadata and controls

52 lines (34 loc) · 1.63 KB

Byte Formatter Library

License Version PHP GitHub stars

A PHP library that formats bytes into a human-readable format and vice versa.

Report a Bug · New Pull Request

Overview

This library provides functionality to convert bytes into a human-readable format and vice versa. It allows customization of formatting options and supports error handling for invalid inputs.

Installation

You can install this library via Composer. Run the following command:

composer require ramazancetinkaya/byte-formatter

Usage

<?php

require 'vendor/autoload.php'; // Composer autoload file

use ramazancetinkaya\ByteFormatter;

// Create an instance of ByteFormatter
$formatter = new ByteFormatter();

// Format bytes
echo $formatter->format(2048); // Output: 2 KB

// Convert from human-readable size to bytes
echo $formatter->convertToBytes('2 KB'); // Output: 2048

Contributing

Contributions are welcome! Please fork the repository and create a pull request.

License

This project is licensed under the MIT License. For more details, see the LICENSE file.