Getting started
Requirements
Section titled “Requirements”- PHP 8.2 or newer
- The
opensslextension
Before you start
Section titled “Before you start”You need a running imgproxy instance to serve the URLs. This library only builds them.
Installation
Section titled “Installation”composer require somehow-digital/imgproxyFirst URL
Section titled “First URL”use SomehowDigital\ImgProxy\Option\Height;use SomehowDigital\ImgProxy\Option\Width;use SomehowDigital\ImgProxy\Url;
$url = Url::create() ->source('https://example.com/image.jpg') ->options( new Width(100), new Height(100), );
$url->build();// _/w:100/h:100/plain/https%3A%2F%2Fexample.com%2Fimage.jpgbuild() returns the path of the URL. Prepend the address of your imgproxy instance to serve it:
$address = 'https://imgproxy.example.com/' . $url->build();The leading _ is the placeholder imgproxy accepts when signing is not used.