Blog User Guide Documentation API Login Register

Documentation > Reference

Asset Helpers

Last updated February 16, 2024

Available Methods

Method Listing

byte_converter()

The byte_converter method converts one byte type into another byte type.

$megabytes = byte_converter('3072', 'KB', 'MB');

// 3MB

$kilobytes = byte_converter('1024', 'B', 'KB');

// 1KB

convert_to_bytes()

The convert_to_bytes method converts a human readable file size to bytes. If the byte format is not provided, it'll be presumed as bytes.

$fileSize = convert_to_bytes('3MB');

// 3145728

friendly_byte()

The friendly_byte method convert bytes to a human readable format.

$fileSize = friendly_byte('5242880');

// 5MB