PHPackages                             flobbos/laravel-image-cache - 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. flobbos/laravel-image-cache

ActiveLaravel

flobbos/laravel-image-cache
===========================

Replacement for the now abandoned imagecache package by Intervention

v0.0.3(10mo ago)071↓50%MITPHPPHP ^8.1

Since Apr 2Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/Flobbos/laravel-image-cache)[ Packagist](https://packagist.org/packages/flobbos/laravel-image-cache)[ RSS](/packages/flobbos-laravel-image-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Laravel Image Cache
===================

[](#laravel-image-cache)

Laravel Image Cache is a package that provides an easy-to-use caching mechanism for image manipulation in Laravel. It serves as a replacement for the now-abandoned imagecache package by Intervention.

Features
--------

[](#features)

- Cache manipulated images for improved performance.
- Support for multiple image drivers: GD, Imagick, and Libvips.
- Define custom image manipulation templates.
- Configurable cache lifetime and output formats.
- Dynamic routing for serving cached images.

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

[](#installation)

1. Install the package via Composer:

    ```
    composer require flobbos/laravel-image-cache
    ```
2. Publish the configuration file:

    ```
    php artisan vendor:publish --tag=config --provider="Flobbos\LaravelImageCache\ImageCacheServiceProvider"
    ```
3. Configure the `config/imagecache.php` file as needed.

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

To use the package, you can define templates in the configuration file and use the `ImageCache` facade to generate cached images.

```
use Flobbos\LaravelImageCache\Facades\ImageCache;

// Example: Apply the "small" template to an image
$cachedImage = ImageCache::template('path/to/image.jpg', 'small');
```

### Dynamic Image Routes

[](#dynamic-image-routes)

The package provides a dynamic route for serving cached images. For example:

```
/images/{template}/{path}

```

- `template`: The name of the template defined in the configuration file.
- `path`: The relative path to the image in the `public/images` directory.

Example URL:

```
http://your-app.test/images/small/example.jpg

```

### Custom Templates

[](#custom-templates)

You can define custom templates by creating a class that implements a `build` method. For example:

```
namespace App\ImageTemplates;

use Intervention\Image\Interfaces\ImageInterface;

class CustomTemplate
{
    public function build(ImageInterface $image)
    {
        $image->resize(800, 600);
    }
}
```

Then, register the template in the `config/imagecache.php` file:

```
'templates' => [
    'custom' => \App\ImageTemplates\CustomTemplate::class,
],
```

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

[](#configuration)

The configuration file `config/imagecache.php` allows you to customize:

- **lifetime**: Cache lifetime in minutes.
- **driver**: Image processing driver (`gd`, `imagick`, or `vips`).
- **store**: Cache store to use (from your Laravel cache config).
- **format**: Default output format (e.g., `jpg`, `png`).
- **return\_obj**: Whether to return an Intervention Image object or a response.
- **templates**: Image manipulation templates (see above for custom templates).
- **paths**: Directories to search for images (see below).
- **route**: The dynamic route name for serving images.

### Paths

[](#paths)

You can specify one or more directories where the package should look for images.
Example from `config/imagecache.php`:

```
'paths' => [
    public_path('images'),
    storage_path('app/public/images'),
],
```

When a request is made, the package will search these directories for the requested image file in the order listed.

### Dynamic Image Routes

[](#dynamic-image-routes-1)

By default, the package registers a dynamic route for serving cached images:

```
/images/{template}/{path}

```

- `template`: The name of the template defined in your configuration.
- `path`: The relative path to the image file.

**Example URL:**

```
http://your-app.test/images/small/example.jpg

```

#### Customizing the Route

[](#customizing-the-route)

You can change the route prefix by editing the `route` option in `config/imagecache.php`:

```
'dynamic_route' => 'images',
```

For example, setting `'dynamic_route' => 'imgcache'` will make your URLs look like:

```
http://your-app.test/imgcache/small/example.jpg

```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10 or higher
- Intervention Image 3.0 or higher

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

- Developed by Alexej Krzewitzki ()
- Inspired by the original imagecache package by Intervention

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance54

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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 ~48 days

Total

3

Last Release

314d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/74704c23d1a3ea66e1ddd18de4e90635ea4a2c28838e72ad49ba947694f7988e?d=identicon)[Flobbos](/maintainers/Flobbos)

### Embed Badge

![Health badge](/badges/flobbos-laravel-image-cache/health.svg)

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

###  Alternatives

[laravolt/avatar

Turn name, email, and any other string into initial-based avatar or gravatar.

2.0k5.4M31](/packages/laravolt-avatar)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)

PHPackages © 2026

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