Download the PHP package componenta/image-compressor without Composer
On this page you can find all versions of the php package componenta/image-compressor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download componenta/image-compressor
More information about componenta/image-compressor
Files in componenta/image-compressor
Package image-compressor
Short Description Image compression helpers for Componenta
License MIT
Informations about the package image-compressor
Componenta Image Compressor
Image compression helpers for Componenta. The package compresses image content without changing its format and selects a concrete compressor by detected MIME type.
Installation
The package declares Componenta\Image\ImageCompressorConfigProvider in extra.componenta.config-providers.
When componenta/composer-plugin is installed, the provider is added to the generated provider list automatically.
The package requires PHP ^8.4, ext-gd, componenta/config, componenta/mimetype-detector, PSR-11, and PSR-7 streams.
Main API
$source may be a binary string or StreamInterface. CompressedImage contains content, mimeType, extension, and computed size.
Supported Formats
Built-in GD compressors support JPEG, PNG, WebP, and AVIF when the local GD extension supports the target operation.
Configuration
ImageCompressorConfigProvider registers:
ImageCompressorGdJpegCompressorGdPngCompressorGdWebPCompressorGdAvifCompressor
ImageCompressorFactory uses MimeTypeDetectorInterface from the container when available and falls back to FinfoDetector.
Options And Errors
ImageCompressionOptions::$quality must be null or an integer from 0 to 100. Invalid quality throws CompressionException::invalidQuality().
ImageCompressor throws CompressionException when the source type cannot be detected or no compressor supports it.
Extension Points
Implement ImageCompressorInterface and call ImageCompressor::addCompressor() to add another compressor.
All versions of image-compressor with dependencies
ext-gd Version *
componenta/config Version ^1.0 || ^2.0.2
componenta/mimetype-detector Version ^1.0.1
psr/container Version ^2.0
psr/http-message Version ^2.0