PHPackages                             enrisezwolle/image-optimizer-for-laravel - 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. [Image &amp; Media](/categories/media)
4. /
5. enrisezwolle/image-optimizer-for-laravel

ActiveLibrary[Image &amp; Media](/categories/media)

enrisezwolle/image-optimizer-for-laravel
========================================

This is my package image-optimizer-for-laravel

2.4.1(6mo ago)0392MITPHPPHP ^8.2CI passing

Since Mar 14Pushed 6mo agoCompare

[ Source](https://github.com/EnriseZwolle/image-optimizer-for-laravel)[ Packagist](https://packagist.org/packages/enrisezwolle/image-optimizer-for-laravel)[ Docs](https://github.com/enrisezwolle/image-optimizer-for-laravel)[ GitHub Sponsors]()[ RSS](/packages/enrisezwolle-image-optimizer-for-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (25)Used By (0)

Image optimizer for laravel
===========================

[](#image-optimizer-for-laravel)

This package allows you to easily optimize images with the power of components, helper methods and facades. It allows you to easily scale images down, compress images or convert it to the webp format for performance.

Optimized images are automatically stored in a storage disk. For this you can use the default disk or use a pre-existing one. When loading an image it will first try to read the file from the storage. If a cached version does not exist it will generate a new image.

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

[](#installation)

You can install the package via composer:

```
composer require enrisezwolle/image-optimizer-for-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --tag="image-optimizer-for-laravel-config"
```

This is the contents of the published config file:

```
return [
    'disk' => [
        /*
         * Set te disk name. You can use your own or register a new one.
         */
        'name' => 'image-optimizer',

        /*
         * Config can be null when using an existing disk name.
         * When disk has not yet been registered image-optimizer will register a new disk using this config.
         */
        'config' => [
            'driver' => 'local',
            'root' => storage_path('app/image-optimizer'),
            'url' => env('APP_URL').'/optimizer',
            'visibility' => 'public',
            'throw' => false,
            'report' => false,
        ],

        /*
         * To access images stored in the drive registering storage links might be necessary.
         * This can be null when using a pre-existing disk.
         * Please run `php artisan storage:link` to create the symlink in the public directory.
         */
        'links' => [
            public_path('optimizer') => storage_path('app/image-optimizer'),
        ],
    ],

    /*
     * The driver that will be used to create images. Can be set to gd or imagick.
     */
    'driver' => 'gd',

    /*
     * The widths an image is stored in.
     * Image optimizer will only use these image widths.
     * When optimizer is given a width not in this list it will scale up to the next available width.
     * For example: when given a width of 320 it will create an image width a width of 500.
     */
    'dimensions' => [
        100,
        250,
        300,
        500,
        750,
        1000,
        1500,
        2000,
    ],

    /*
     * When set to true images will be constrained to the maximum width defined in 'dimensions'.
     */
    'limit-width' => true,
];
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="image-optimizer-for-laravel-views"
```

Usage
-----

[](#usage)

There are multiple ways to use this package.

### View Components

[](#view-components)

This package comes with two components out of the box.

Both components accept the following 4 parameters

- src: The path to the image. This can be a relative or an absolute path.
- Quality: Optional - Default quality of 80
- width: Optional - The minimum width of the image. It will pick the closest dimension set in the config
- webp: Optional - Determines if the image should be converted to the webp format

#### Image

[](#image)

```

```

#### Source

[](#source)

```

```

When relative paths cannot be resolved please use a full path for example:

```

```

### Facade

[](#facade)

This package also comes with a facade if you would rather write your own implementation.

```
use EnriseZwolle\ImageOptimizer\Facades\ImageOptimizer

// Generate an optimized image
ImageOptimizer::getImage(
    src: 'image.jpg',
    quality: 65,
    width: null,
    webp: false
);

// Clear the cache
// Caution - this deletes EVERY file in the configured storage drive
ImageOptimizer::clearCache();
```

### Helper

[](#helper)

This package also supplies a handy helpers to optimize your images.

```
optimize_image(
    src: 'image.jpg',
    width: 500,
    quality: 70,
    webp: false,
)
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance66

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~11 days

Recently: every ~30 days

Total

21

Last Release

200d ago

Major Versions

1.1.0 → 2.1.02025-06-18

1.2.1 → 2.2.22025-06-27

1.2.3 → 2.3.02025-07-03

1.3.0 → 2.4.02025-09-25

1.4.1 → 2.4.12025-10-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/230d6e0f51953b32f590d5c2cf72296a0fa5fc40a55619307a8e68114618f979?d=identicon)[EnriseZwolle](/maintainers/EnriseZwolle)

---

Top Contributors

[![maikelenrise](https://avatars.githubusercontent.com/u/51745264?v=4)](https://github.com/maikelenrise "maikelenrise (2 commits)")[![DaanTimmerman1](https://avatars.githubusercontent.com/u/184112698?v=4)](https://github.com/DaanTimmerman1 "DaanTimmerman1 (1 commits)")

---

Tags

laravelEnrise Zwolleimage-optimizer-for-laravel

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/enrisezwolle-image-optimizer-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/enrisezwolle-image-optimizer-for-laravel/health.svg)](https://phpackages.com/packages/enrisezwolle-image-optimizer-for-laravel)
```

###  Alternatives

[saasykit/laravel-open-graphy

An awesome open graph image (social cards) generator package for Laravel.

13057.0k](/packages/saasykit-laravel-open-graphy)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[joshembling/image-optimizer

Optimize your Filament images before they reach your database.

111145.4k12](/packages/joshembling-image-optimizer)[ace-of-aces/laravel-image-transform-url

Easy, URL-based image transformations inspired by Cloudflare Images.

1756.4k](/packages/ace-of-aces-laravel-image-transform-url)[danihidayatx/image-optimizer

Optimize your Filament images before they reach your database. Forked from joshembling/image-optimizer for Filament v4 &amp; v5 support.

254.4k](/packages/danihidayatx-image-optimizer)[johncarter/filament-focal-point-picker

An image focal point picker for Filament Admin.

4326.5k1](/packages/johncarter-filament-focal-point-picker)

PHPackages © 2026

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