onliner/imgproxy-php

ImgProxy url builder for PHP

Package info

github.com/onliner/imgproxy-php

pkg:composer/onliner/imgproxy-php

Statistics

Installs: 214 769

Dependents: 2

Suggesters: 0

Stars: 25

Open Issues: 0

v0.2.6 2026-04-01 11:21 UTC

Requires

  • php: ^8.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 82762100d0e22e8ea26e9c97ae976572ee245575

imageresizeimgproxyimageproxy

This package is auto-updated.

Last update: 2026-05-31 11:39:43 UTC


README

ImgProxy PHP

This is a PHP library that makes it easy to build URL for ImgProxy.

👁 Version
👁 Total Downloads
👁 Php
👁 License
👁 Build Status

Installation

The preferred way to install this extension is through composer.

Either run

composer require onliner/imgproxy-php:^0.2

or add this code line to the require section of your composer.json file:

"onliner/imgproxy-php": "^0.2"

Usage

$key = getenv('IMGPROXY_KEY');
$salt = getenv('IMGPROXY_SALT');

$src = 'http://example.com/image.jpg';

$builder = UrlBuilder::signed($key, $salt);
$builder = $builder->with(
 new Dpr(2),
 new Quality(90),
 new Width(300),
 new Height(400)
);
 
$url = $builder->url($src); // encoded url
$url = $builder->encoded(false)->url($src); // plain url
$url = $builder->url($src, 'png'); // change image format

# example: /9SaGqJILqstFsWthdP/dpr:2/q:90/w:300/h:400/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/LmpwZw

License

Released under the MIT license.