Download the PHP package harorudo/media-compressor without Composer
On this page you can find all versions of the php package harorudo/media-compressor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download harorudo/media-compressor
More information about harorudo/media-compressor
Files in harorudo/media-compressor
Package media-compressor
Short Description A Laravel utility for compressing images, PDFs, and files - powered by Intervention Image and Ghostscript
License MIT
Informations about the package media-compressor
harorudo/media-compressor
A Laravel utility for compressing images, PDFs, and files — powered by Intervention Image and Ghostscript.
Requirements
- PHP ^8.2
- Laravel ^10.0 | ^11.0
- Intervention Image ^2.7
- Ghostscript (for PDF compression)
Installation
Laravel auto-discovers the service provider. No manual registration needed.
Verify your environment
Run the doctor command to confirm Ghostscript and the image backend are installed:
Install Ghostscript
Ubuntu / Debian:
macOS:
Windows:
Download from ghostscript.com/releases and ensure gswin64c.exe is in your PATH.
Configuration
Publish the config file:
config/compression.php:
Usage
Inject CompressionUtil directly or use the Compression facade.
Images
PDFs
PDF presets
| Preset | Image DPI | Best for |
|---|---|---|
screen |
72 | Email attachments, smallest size |
ebook |
150 | General use — recommended default |
printer |
300 | High-quality downloads |
prepress |
300 + colour | Print-ready, near-lossless |
ZIP
Return value
Every method returns an array with savings stats:
Security
This package enforces the following guards on every operation:
- MIME type validation — server-side detection, client header is never trusted
- File size limit — configurable via
compression.max_file_size - Storage disk allowlist — configurable via
compression.allowed_disks - Directory sanitization — strips invalid characters to prevent path traversal
- Safe filenames — client filenames never touch the filesystem; hashed names are always used
- Temp file cleanup — guaranteed via
finallyblocks, even on failure
License
MIT © Eddy Harold
All versions of media-compressor with dependencies
intervention/image Version ^2.7
illuminate/support Version ^10.0|^11.0|^12.0