Laravel File Compressor
Open SourceIn progress

Laravel File Compressor

Laravel package for automatic image, PDF and video compression, published on Packagist.

Design and development of an open source Laravel package published on Packagist (justsmiletoo/laravel-file-compressor). Automatic file compression with MIME type detection and delegation to the appropriate compressor, zero manual configuration required.

Image compression via Intervention Image v3 (GD or Imagick drivers) with proportional resizing, configurable quality, maximum dimensions, and format conversion (WebP, PNG, JPG). Named preset system (avatar 200x200, thumbnail 300x300, banner 1920x600) with resize modes (proportional scale or cover with cropping). PDF compression via Ghostscript with quality levels (screen 72dpi, ebook 150dpi, printer 300dpi, prepress). Video compression via FFmpeg with H.264 codec, configurable CRF, speed presets, and resizing.

Extensible architecture: CompressorInterface, DTOs (CompressionResult with saved bytes calculation and percentage, UploadResult), StorageManager with naming strategies (timestamp_hex, uuid, ulid), Laravel facade, and service provider with dependency injection. Typed error handling (UnsupportedFileTypeException, CompressionException, BinaryNotFoundException).

Fully configurable via config file and environment variables. CI/CD pipeline with PHPStan, Pint, tests, and Release Please for automatic semantic versioning.

Repositories

library
PHPLaravelGitHub ActionsGitGitHubPestPHPStanComposerLaravel PintIntervention ImageFFmpegImageMagickRelease Please
View