PHPackages                             whagency/yii2-imagecache - 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. [Caching](/categories/caching)
4. /
5. whagency/yii2-imagecache

ActiveYii2-extension[Caching](/categories/caching)

whagency/yii2-imagecache
========================

Yii2 image cache

1.0.4(4y ago)3675MITPHPPHP &gt;=5.4

Since Jun 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/whagency/yii2-imagecache)[ Packagist](https://packagist.org/packages/whagency/yii2-imagecache)[ RSS](/packages/whagency-yii2-imagecache/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (5)Used By (0)

yii2-imagecache
===============

[](#yii2-imagecache)

Yii2 extension for generating images based on Imagick

[![Latest Stable Version](https://camo.githubusercontent.com/6c1a195196450cc0237c390eb45b841e06c3ed961880094f40f14105e8100914/68747470733a2f2f706f7365722e707567782e6f72672f77686167656e63792f796969322d696d61676563616368652f762f737461626c65)](https://packagist.org/packages/whagency/yii2-imagecache)[![License](https://camo.githubusercontent.com/ad3cd03713143cfd2e8ed2b60428aad9eea052a807460ec2e8ed1bce6f9e707e/68747470733a2f2f706f7365722e707567782e6f72672f77686167656e63792f796969322d696d61676563616368652f6c6963656e7365)](https://packagist.org/packages/whagency/yii2-imagecache)

Capabilities
------------

[](#capabilities)

- FIT - resize image WITH proportion and based on BOTH sides
- Scale - resize image WITH proportion and based on ONE sides
- Crop - crop image WITH proportion
- Generate black-and-white image
- Add watermark to the image
- Add background color for FITed images

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require "whagency/yii2-imagecache" "*"

```

or add to your composer.json file

```
"require": {
    "whagency/yii2-imagecache": "*"
},
```

Config
------

[](#config)

```
'components' => [
    ...
    'imageCache' => [
        'class' => 'webheads\imagecache\imageCache',
        'cachePath' => '@app/web/files/cache',
        'cacheUrl' => '@web/files/cache',
    ],
]
```

Usage Example PHP 8.0
---------------------

[](#usage-example-php-80)

```
Yii::$app->imageCache->img('/files/image.jpg', imagick_options: ['fit' => 300, 'bg' => '#ff0000', 'watermark' => '@app/web/files/images/wmk.png'])
// Result: image 300 x 300 without cropping, with watermark and background color.
```

Usage Example
-------------

[](#usage-example)

```
echo Yii::$app->imageCache->imgSrc('@app/web/files/image.jpg', '', ['fit' => 300, 'bw' => true, 'watermark' => '@app/web/files/watermark-image.png']);
// Result: path to black-and-white image 300 x 300 without cropping, with watermark.

echo Yii::$app->imageCache->img('@app/web/files/image.jpg', '400x', ['class'=>'my-class', 'alt' => 'Image']);
// Result: scaled image with width = 400, alt and class.

echo Yii::$app->imageCache->img('@app/web/files/image.jpg', '100x150', ['alt' => 'Image'], ['bw' => true]);
// Result: resized and cropped black-and-white image 100 x 150 with alt.
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~442 days

Total

4

Last Release

1555d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a80b722075e3a60545da46e4a83ae2b0a05c197d779378ee70f6f3924b1f027?d=identicon)[whagency](/maintainers/whagency)

---

Top Contributors

[![whagency](https://avatars.githubusercontent.com/u/40386084?v=4)](https://github.com/whagency "whagency (17 commits)")

---

Tags

thumbnailimageresizewatermarkcacheyii2crop

### Embed Badge

![Health badge](/badges/whagency-yii2-imagecache/health.svg)

```
[![Health](https://phpackages.com/badges/whagency-yii2-imagecache/health.svg)](https://phpackages.com/packages/whagency-yii2-imagecache)
```

###  Alternatives

[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

860918.1k11](/packages/sybio-image-workshop)[jbzoo/image

A PHP class that simplifies working with images

171126.9k3](/packages/jbzoo-image)[sadovojav/yii2-image-thumbnail

Yii2 image thumbnail component

2142.1k](/packages/sadovojav-yii2-image-thumbnail)

PHPackages © 2026

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