PHPackages                             itiden/opixlig - 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. [Templating &amp; Views](/categories/templating)
4. /
5. itiden/opixlig

ActiveLibrary[Templating &amp; Views](/categories/templating)

itiden/opixlig
==============

Perfectly sized. Never pixelated.

v1.0.0(4w ago)1142MITPHPPHP ^8.1.0CI passing

Since Apr 30Pushed 4w agoCompare

[ Source](https://github.com/itiden/laravel-opixlig)[ Packagist](https://packagist.org/packages/itiden/opixlig)[ RSS](/packages/itiden-opixlig/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (7)Dependencies (23)Versions (14)Used By (0)

Opixlig
=======

[](#opixlig)

**Perfectly sized. Never pixelated.**

**Opixlig** is a Laravel-friendly image component inspired by modern frameworks like Next.js — designed to make responsive, optimized images effortless. It automatically generates and serves the right image size and format for every device, keeping your pages fast, sharp, and beautifully adaptive. Write clean Blade, and let **Opixlig** handle the rest.

[![Latest Version on Packagist](https://camo.githubusercontent.com/b4752ff7db41159535bbbc636adc00847fbdc1ba6b3d9731e611387b7829fedf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69746964656e2f6f7069786c69672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itiden/opixlig)[![Total Downloads](https://camo.githubusercontent.com/14f6cbd28fa9d5c57f62d4cf060924963e717d2016eff84e43fb2b8ef0fb1eb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69746964656e2f6f7069786c69672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itiden/opixlig)[![License](https://camo.githubusercontent.com/2399e8b183e5eed1290863c8599a21a6586cbb0461831c60640966e876abae92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f69746964656e2f6f7069786c69672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itiden/opixlig)

Features
--------

[](#features)

- 🖼️ **Responsive images**: Automatically generates and serves appropriately sized images for any device
- 🚀 **Performance optimized**: Converts images to modern formats like WebP for faster loading
- 📱 **Adaptive srcsets**: Creates optimized srcsets for both responsive and fixed-width images
- 🔍 **Placeholder support**: Includes "blur" and "empty" placeholder options while images load
- ⚙️ **Highly configurable**: Customize quality, widths, and more to fit your needs
- 🎯 **Presets**: Define reusable image configurations for consistent sizing across your app
- 🛠️ **Simple API**: Clean Blade component syntax that feels natural in your Laravel views

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

[](#installation)

You can install the package via composer:

```
composer require itiden/opixlig
```

### Publishing the config

[](#publishing-the-config)

```
php artisan vendor:publish --tag="itiden-opixlig-config"
```

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

[](#configuration)

After publishing the config file, you can customize the following settings in `config/opixlig.php`:

```
return [
    // Where generated images are stored in your storage directory
    'storage_folder' => 'app/.images',

    // Public URL path to access the images
    'public_folder' => 'images',

    // Image manipulation driver ('imagick' or 'gd')
    'driver' => 'imagick',

    // Defaults for image output
    'defaults' => [
        // Default widths for responsive images
        'widths' => [384, 640, 828, 1200, 2048, 3840],

        // Default placeholder type ('empty' or 'blur')
        'placeholder' => 'empty',

        // Default image quality (1-100)
        'quality' => 75,

        // Default image format ('webp', 'avif', 'png', 'jpg', 'pjpg', 'gif', 'heic')
        'format' => 'webp',
    ],

    // Reusable image presets
    'presets' => [
        // 'thumbnail' => [
        //     'width' => 150,
        //     'height' => 150,
        //     'quality' => 60,
        //     'fit' => 'crop-center',
        //     'placeholder' => 'blur',
        // ],
    ],

    // Cache busting strategy: null (disabled) or 'mtime' (file modification time)
    'version' => null,
];
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

Use the Blade component in your views:

```

```

> **Note:** `width` and `height` must always be provided together. Supplying only one will throw an `InvalidArgumentException`. Omitting both is valid and renders a plain `` with no srcset.

### Responsive Images with Custom Sizes

[](#responsive-images-with-custom-sizes)

```

```

### Using Blur Placeholder

[](#using-blur-placeholder)

```

```

### Custom Quality

[](#custom-quality)

```

```

### Cropped Image

[](#cropped-image)

```

```

### Additional Manipulations

[](#additional-manipulations)

```

```

### Presets

[](#presets)

Define reusable image configurations in your `config/opixlig.php`:

```
'presets' => [
    'avatar' => [
        'width' => 64,
        'height' => 64,
        'quality' => 70,
        'fit' => 'crop-center',
        'placeholder' => 'blur',
    ],
    'hero' => [
        'width' => 1200,
        'height' => 630,
        'format' => 'avif',
        'quality' => 85,
    ],
    'og-image' => [
        'w' => 1200,
        'h' => 630,
        'fm' => 'jpg',
        'q' => 80,
    ],
],
```

Presets support both friendly names (`width`, `height`, `format`, `quality`) and Glide shorthand keys (`w`, `h`, `fm`, `q`). You can also include any [Glide manipulation](https://glide.thephpleague.com/2.0/api/quick-reference/) like `blur`, `filt`, or `sharp`, as well as `placeholder` and `widths`.

Use a preset via the `preset` prop:

```

```

Inline props override preset values, so you can use a preset as a base and tweak individual settings:

```

```

Presets can also define custom `widths` for responsive srcsets:

```
{{-- Config: 'banner' => ['w' => 1200, 'h' => 400, 'widths' => [400, 800, 1200]] --}}

```

### Using the Helper Function

[](#using-the-helper-function)

You can also use the `img()` helper function directly:

```
$imageUrl = img('public/images/hero.jpg', 800, 600, ['fm' => 'webp', 'q' => 80])->url(['w' => 800]);
```

The helper also supports presets:

```
$avatarUrl = img('public/images/profile.jpg', preset: 'avatar')->url(['w' => 64]);
```

### Cache Busting

[](#cache-busting)

When an image is updated, browsers may serve a stale cached version. Opixlig supports cache busting by embedding a version identifier into the URL path, ensuring updated images get a new URL.

#### Automatic versioning (mtime)

[](#automatic-versioning-mtime)

Set the `version` config to `'mtime'` to automatically use the file's last modification time:

```
// config/opixlig.php
'version' => 'mtime',
```

Every time the source file changes, the generated URLs will change too, forcing browsers to fetch the new version.

> **Note:** The `mtime` strategy requires a filesystem `lastModified()` call per URL generated. This works reliably on local disks but may add latency on remote filesystems (S3, GCS).

#### Explicit versioning

[](#explicit-versioning)

Use the `version` prop to manually control cache busting:

```

```

The explicit `version` prop always takes precedence over the config strategy. The value is sanitized to a URL-safe slug.

The helper function also supports versioning:

```
$imageUrl = img('public/images/hero.jpg', 800, 600, ['fm' => 'webp'], version: '2')->url(['w' => 800]);
```

Advanced Usage
--------------

[](#advanced-usage)

### Available Props

[](#available-props)

PropTypeDefaultDescriptionsrcstring''Path to the source image (including disk name e.g., 'public/images/file.jpg')presetstring''Name of a preset defined in `config('opixlig.presets')`. Inline props override preset values.sizesstring''Media query sizes attribute for responsive imageswidthnumber''Width of the image. Must be provided together with `height` — supplying only one throws an error.heightnumber''Height of the image. Must be provided together with `width` — supplying only one throws an error.loadingstring'lazy'Image loading strategy ('lazy', 'eager', 'auto')decodingstring'async'Image decoding strategy ('async', 'sync', 'auto')qualitynumberconfig('opixlig.defaults.quality')Image quality (1-100)placeholderstringconfig('opixlig.defaults.placeholder')Placeholder type ('empty' or 'blur')formatstringconfig('opixlig.defaults.format')Image format ('jpg', 'pjpg', 'png', 'gif', 'webp', 'avif', 'heic'\*). \*heic only supported with Imagick driverfitstring''How the image is fitted to its target dimensions. Values: 'contain', 'max', 'fill', 'fill-max', 'stretch', 'crop'. For crop positioning, use e.g. 'crop-center', 'crop-top', or Statamic focal points like 'crop-44-13-1'manipulationsarray\[\]Additional [Glide manipulations](https://glide.thephpleague.com/2.0/api/quick-reference/) as key-value pairsversionstringnullExplicit cache-busting version identifier. Overrides the `version` config strategy. Value is sanitized to a URL-safe slug.### Image Manipulations

[](#image-manipulations)

The `fit` prop covers the most common resize/crop use cases (including Statamic focal point crops like `fit="crop-44-13-1"`), but you can pass any [Glide manipulation parameter](https://glide.thephpleague.com/2.0/api/quick-reference/) via the `manipulations` prop:

```

```

All supported Glide manipulations:

ParameterKeyDescriptionWidth`w`Width in pixels (set via `width` prop)Height`h`Height in pixels (set via `height` prop)Fit`fit`Resize method (set via `fit` prop)Crop`crop`Pixel-based crop: 'width,height,x,y' (via `manipulations`)Quality`q`Image quality, 0-100 (set via `quality` prop)Format`fm`Output format (set via `format` prop)Blur`blur`Blur amount (0-100)Sharpen`sharp`Sharpen amount (0-100)Brightness`bri`Brightness adjustment (-100 to 100)Contrast`con`Contrast adjustment (-100 to 100)Gamma`gam`Gamma adjustment (0.1 to 9.99)Pixelate`pixel`Pixelate amount (0-1000)Filter`filt`Filter ('greyscale', 'sepia')Flip`flip`Flip ('h', 'v', 'both')Orientation`or`Rotation ('auto', '90', '180', '270')Background`bg`Background color (hex, e.g. 'fff')Border`border`Border ('width,color,method')How It Works
------------

[](#how-it-works)

1. The component generates optimized images on demand
2. Images are processed using the configured driver (Imagick or GD)
3. Processed images are stored in the configured cache directory
4. Subsequent requests for the same image with the same parameters are served directly from cache without hitting laravel
5. The package automatically generates appropriate srcsets for responsive designs

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.5% 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

Every ~65 days

Recently: every ~93 days

Total

7

Last Release

28d ago

Major Versions

v0.6.0 → v1.0.02026-05-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13601619?v=4)[Itiden](/maintainers/itiden)[@itiden](https://github.com/itiden)

---

Top Contributors

[![danielbrodin](https://avatars.githubusercontent.com/u/696872?v=4)](https://github.com/danielbrodin "danielbrodin (47 commits)")[![andreasbergqvist](https://avatars.githubusercontent.com/u/1663126?v=4)](https://github.com/andreasbergqvist "andreasbergqvist (6 commits)")[![evelynfredin](https://avatars.githubusercontent.com/u/45714191?v=4)](https://github.com/evelynfredin "evelynfredin (4 commits)")

---

Tags

laravelpackagestatamiclaravelpackageimagebladestatamic

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/itiden-opixlig/health.svg)

```
[![Health](https://phpackages.com/badges/itiden-opixlig/health.svg)](https://phpackages.com/packages/itiden-opixlig)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.5k](/packages/larastan-larastan)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[ralphjsmit/laravel-glide

Auto-magically generate responsive images from static image files.

4923.6k5](/packages/ralphjsmit-laravel-glide)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)

PHPackages © 2026

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