PHPackages                             rikodev/laravel-imgproxy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rikodev/laravel-imgproxy

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rikodev/laravel-imgproxy
========================

Signed imgproxy URL builder for Laravel.

v1.0.0(today)01—0%MITPHPPHP ^8.4

Since Mar 21Pushed todayCompare

[ Source](https://github.com/RikoDEV/laravel-imgproxy)[ Packagist](https://packagist.org/packages/rikodev/laravel-imgproxy)[ RSS](/packages/rikodev-laravel-imgproxy/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

rikodev/laravel-imgproxy
========================

[](#rikodevlaravel-imgproxy)

Signed [imgproxy](https://imgproxy.net) URL builder for Laravel with full IDE autocomplete via typed options, backed enums, and PHP 8.4 property hooks.

---

Installation
------------

[](#installation)

```
composer require rikodev/laravel-imgproxy
```

Publish the config file (optional — the package merges its own defaults automatically):

```
php artisan vendor:publish --tag=imgproxy-config
```

---

Configuration
-------------

[](#configuration)

Add the following keys to your `.env`:

KeyDefaultDescription`IMGP_KEY``''`Imgproxy signing key (hex-encoded)`IMGP_SALT``''`Imgproxy signing salt (hex-encoded)`IMGP_HOST``https://imgproxy.example.com`Imgproxy instance base URL`IMGP_DEBUG_URL_FROM``http://example.test`Local origin replaced in debug mode`IMGP_DEBUG_URL_TO``https://example.pro`Production origin used instead> **Debug URL rewrite** — imgproxy is a remote service and cannot reach `localhost`. In debug mode the package automatically rewrites the local origin to the production origin so imgproxy can fetch the source image.

---

Usage
-----

[](#usage)

### Global helper (recommended)

[](#global-helper-recommended)

```
use RikoDEV\LaravelImgproxy\Options;
use RikoDEV\LaravelImgproxy\Enums\ResizeType;
use RikoDEV\LaravelImgproxy\Enums\Gravity;
use RikoDEV\LaravelImgproxy\Enums\Format;

imgproxy($url, new Options(...))
```

### Facade

[](#facade)

```
use RikoDEV\LaravelImgproxy\Facades\Imgproxy;

Imgproxy::url($url, new Options(...))
```

### Direct injection

[](#direct-injection)

```
use RikoDEV\LaravelImgproxy\ImgproxyManager;

class MyService
{
    public function __construct(private readonly ImgproxyManager $imgproxy) {}

    public function thumbnail(string $url): string
    {
        return $this->imgproxy->url($url, new Options(width: 400, height: 300));
    }
}
```

---

Options reference
-----------------

[](#options-reference)

All parameters are **named**, so your IDE shows every option with its type as you type `new Options(`.

```
new Options(
    width:      ?int,        // Output width in pixels
    height:     ?int,        // Output height in pixels
    resize:     ResizeType,  // Resize algorithm (default: ResizeType::Fit)
    gravity:    ?Gravity,    // Crop gravity / focus point
    quality:    ?int,        // Output quality 1–100 (JPEG / WebP)
    enlarge:    bool,        // Allow enlarging beyond original size (default: false)
    format:     ?Format,     // Convert to this format (also sets the file extension)
    blur:       ?float,      // Gaussian blur sigma 0.3–1000
    brightness: ?int,        // Brightness adjustment -255–255
    contrast:   ?float,      // Contrast multiplier
    saturation: ?float,      // Saturation multiplier
)
```

### ResizeType enum

[](#resizetype-enum)

CaseValueDescription`ResizeType::Fit``fit`Keeps aspect ratio, fits the whole image within the box. Default.`ResizeType::Fill``fill`Keeps aspect ratio, fills the box and crops the excess.`ResizeType::Auto``auto`Uses `Fill` when source has an alpha channel, `Fit` otherwise.`ResizeType::ForceFit``force_fit`Same as `Fit` but never enlarges a smaller source.`ResizeType::ForceFill``force_fill`Same as `Fill` but never enlarges a smaller source.### Gravity enum

[](#gravity-enum)

CaseValueDescription`Gravity::Smart``sm`Content-aware smart crop (imgproxy detects the focus point).`Gravity::Center``ce`Center of the image.`Gravity::North``no`Top edge.`Gravity::South``so`Bottom edge.`Gravity::East``ea`Right edge.`Gravity::West``we`Left edge.`Gravity::NorthEast``noea`Top-right corner.`Gravity::NorthWest``nowe`Top-left corner.`Gravity::SouthEast``soea`Bottom-right corner.`Gravity::SouthWest``sowe`Bottom-left corner.### Format enum

[](#format-enum)

CaseValue`Format::WebP``webp``Format::Avif``avif``Format::Jpeg``jpg``Format::Png``png``Format::Gif``gif`---

Examples
--------

[](#examples)

**Resize to fixed width, keep aspect ratio:**

```
imgproxy($url, new Options(width: 1200))
```

**Thumbnail with smart crop:**

```
imgproxy($url, new Options(
    width:   600,
    height:  400,
    resize:  ResizeType::Fill,
    gravity: Gravity::Smart,
))
```

**Square avatar, converted to WebP:**

```
imgproxy($url, new Options(
    width:  128,
    height: 128,
    resize: ResizeType::Fill,
    format: Format::WebP,
))
```

**High-quality hero image:**

```
imgproxy($url, new Options(
    width:   1920,
    height:  1080,
    resize:  ResizeType::Fill,
    gravity: Gravity::Smart,
    quality: 90,
    format:  Format::Avif,
))
```

**Width only with explicit quality:**

```
imgproxy($url, new Options(width: 800, quality: 75))
```

**Blurred placeholder:**

```
imgproxy($url, new Options(width: 40, height: 40, blur: 10.0))
```

**Reading the computed options string directly (PHP 8.4 property hook):**

```
$opts = new Options(width: 600, height: 400, resize: ResizeType::Fill);

echo $opts->value;   // "rs:fill:600:400:0"
echo (string) $opts; // "rs:fill:600:400:0"
```

---

Legacy string API
-----------------

[](#legacy-string-api)

Raw imgproxy option strings are still accepted by both the helper and the facade — no breaking changes:

```
imgproxy($url, 'w:1200')
imgproxy($url, 's:32:32', 'webp')
imgproxy($url, 'w:600/h:176/rt:fill')
imgproxy($url, 'q:80', Format::WebP)  // Format enum also accepted for $ext
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e6b883f48b11513e2ba86dd74dbb918d3923540a9a7d9fbcd0bd6bef2bce161?d=identicon)[RikoDEV](/maintainers/RikoDEV)

---

Top Contributors

[![RikoDEV](https://avatars.githubusercontent.com/u/18230443?v=4)](https://github.com/RikoDEV "RikoDEV (3 commits)")

### Embed Badge

![Health badge](/badges/rikodev-laravel-imgproxy/health.svg)

```
[![Health](https://phpackages.com/badges/rikodev-laravel-imgproxy/health.svg)](https://phpackages.com/packages/rikodev-laravel-imgproxy)
```

###  Alternatives

[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169175.3k2](/packages/spatie-laravel-mix-preload)[naoray/eloquent-model-analyzer

Helpful methods to gain more information about eloquent model classes.

16429.8k1](/packages/naoray-eloquent-model-analyzer)[frittenkeez/laravel-vouchers

Voucher system for Laravel 9+

5818.8k1](/packages/frittenkeez-laravel-vouchers)[qlick/laravel-full-calendar

Laravel helper for FullCalendar.io. Fork of https://github.com/maddhatter/laravel-fullcalendar

1345.5k](/packages/qlick-laravel-full-calendar)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
