Download the PHP package martincamen/laravel-file-size without Composer
On this page you can find all versions of the php package martincamen/laravel-file-size. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download martincamen/laravel-file-size
More information about martincamen/laravel-file-size
Files in martincamen/laravel-file-size
Package laravel-file-size
Short Description Eloquent file size calculations and formatting for Laravel
License MIT
Homepage https://github.com/martincamen/laravel-file-size
Informations about the package laravel-file-size
Laravel File Size
A fluent, immutable API for converting, comparing, and formatting file sizes in Laravel with support for both binary (1024-based) and decimal (1000-based) byte systems.
Requirements
- PHP 8.3+
- Laravel 12.x+
Installation
The package will automatically register its service provider.
Publish Configuration
Quick Start
Factory Methods
Create FileSize instances using static factory methods:
Specifying Byte Base
Conversions
Convert to specific units:
With Custom Precision
Property Access
Arithmetic Operations
All operations return new immutable instances:
Generic Add/Sub with Unit
Method Chaining
Comparisons
Min/Max
State Checks
Formatting
Automatic Unit Selection
The formatter automatically selects the most appropriate unit:
Decimal vs Binary Labels
Fluent Configuration
Precision
Byte Base
Configuration
Publish the configuration file:
Available Options
Validation
Negative Values
By default, negative input values throw an exception:
Enable negative values in configuration:
Invalid Values
Division by Zero
Accessors
Testing
Code Quality
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-file-size with dependencies
illuminate/support Version ^12.0
martincamen/php-file-size Version ^1.0
spatie/laravel-package-tools Version ^1.16