Skip to content

imgproxy for PHP

Build imgproxy URLs in a type-safe, immutable and composable way.
Terminal window
composer require somehow-digital/imgproxy
use SomehowDigital\ImgProxy\Option\Height;
use SomehowDigital\ImgProxy\Option\Quality;
use SomehowDigital\ImgProxy\Option\Width;
use SomehowDigital\ImgProxy\Url;
$url = Url::create()
->source('https://example.com/image.jpg')
->options(new Width(300), new Height(200), new Quality(80));
$url->build('webp');
// _/w:300/h:200/q:80/plain/https%3A%2F%2Fexample.com%2Fimage.jpg@webp

Immutable

Every method returns a new instance, so a base URL can be shared and extended safely.

Complete

One documented class for each imgproxy processing option, with chained pipelines.

Private and signed

Encode or encrypt the source URL, and sign URLs with HMAC-SHA256.

Pro aware

Options that need imgproxy Pro are marked everywhere.