PHPackages                             intersvyaz/yii2-tag-dependency-helper - 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. intersvyaz/yii2-tag-dependency-helper

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

intersvyaz/yii2-tag-dependency-helper
=====================================

Helper for unifying cache tag names with invalidation support in yii2

1.0.1(10y ago)11081MITPHP

Since Nov 24Pushed 10y ago11 watchersCompare

[ Source](https://github.com/intersvyaz/yii2-tag-dependency-helper)[ Packagist](https://packagist.org/packages/intersvyaz/yii2-tag-dependency-helper)[ RSS](/packages/intersvyaz-yii2-tag-dependency-helper/feed)WikiDiscussions master Synced 1mo ago

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

yii2-tag-dependency-helper
==========================

[](#yii2-tag-dependency-helper)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9c28576746485158a7d91509bb5c44d2e143726175aef21dcc758631d459c620/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e746572737679617a2f796969322d7461672d646570656e64656e63792d68656c7065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/intersvyaz/yii2-tag-dependency-helper/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/4a33d78aac72345366ea08f7a4de1f5dcbd29b26a7289d97edb1a3dd2b062d81/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e746572737679617a2f796969322d7461672d646570656e64656e63792d68656c7065722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/intersvyaz/yii2-tag-dependency-helper/?branch=master)[![Build Status](https://camo.githubusercontent.com/c9b319bf5fd2e4d62a5648aa565a5aae29975f7e6edc40ae4112461af077cdd4/68747470733a2f2f7472617669732d63692e6f72672f696e746572737679617a2f796969322d7461672d646570656e64656e63792d68656c7065722e737667)](https://travis-ci.org/intersvyaz/yii2-tag-dependency-helper)

Helper for unifying cache tag names with invalidation support for Yii2.

Usage
-----

[](#usage)

In your model add behavior:

```
...

use Intersvyaz\TagDependencyHelper\Traits\CachedFind;
use Intersvyaz\TagDependencyHelper\InvalidateTagBehavior;

...

class Configurable extends ActiveRecord
{
    use CachedFind;

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            [
                'class' => InvalidateTagBehavior::class,
                'cache' => 'cache', // optional option - application id of cache component
            ],
        ];
    }
}
```

This behavior automatically invalidates tags by model name and pair model-id.

If your cache entry should be flushed every time any row of model is edited - use `getCommonTag` helper function:

```
use Intersvyaz\TagDependencyHelper\ActiveRecordCacheTags;

...

$models = Configurable::getDb()->cache(
    function ($db) {
        return Configurable::find()->all($db);
    },
    86400,
    new TagDependency([
        'tags' => [ActiveRecordCacheTags::getCommonTag(Configurable::className())],
    ])
);
```

If your cache entry should be flushed only when exact row of model is edited - use `getObjectTag` helper function:

```
use Intersvyaz\TagDependencyHelper\ActiveRecordCacheTags;

...

$cacheKey = 'Product:' . $model_id;
if (false === $product = Yii::$app->cache->get($cacheKey)) {

    if (null === $product = Product::findOne($model_id)) {
        throw new NotFoundHttpException;
    }
    Yii::$app->cache->set(
        $cacheKey,
        $product,
        86400,
        new TagDependency(
            [
                'tags' => [
                    ActiveRecordCacheTags::getObjectTag(Product::class, $model_id),
                ]
            ]
        )
    );
}
```

In the CachedFind trait implemented shortcut method cachedFindOne() and cachedFindAll() for cached find query.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 56.3% 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 ~96 days

Total

3

Last Release

4001d ago

Major Versions

0.0.1 → 1.0.02015-06-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/03f36c54791162f622dde8344f3008eeb39d52d2eca72f2a4af5516da92579a3?d=identicon)[intersvyaz-it](/maintainers/intersvyaz-it)

---

Top Contributors

[![miramir](https://avatars.githubusercontent.com/u/686364?v=4)](https://github.com/miramir "miramir (9 commits)")[![bethrezen](https://avatars.githubusercontent.com/u/260284?v=4)](https://github.com/bethrezen "bethrezen (7 commits)")

---

Tags

cacheyii2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/intersvyaz-yii2-tag-dependency-helper/health.svg)

```
[![Health](https://phpackages.com/badges/intersvyaz-yii2-tag-dependency-helper/health.svg)](https://phpackages.com/packages/intersvyaz-yii2-tag-dependency-helper)
```

###  Alternatives

[devgroup/yii2-tag-dependency-helper

Helper for unifying cache tag names with invalidation support in yii2

34507.4k7](/packages/devgroup-yii2-tag-dependency-helper)[undefinedor/yii2-cached-active-record

The cached activeRecord for the Yii2 framework

102.6k](/packages/undefinedor-yii2-cached-active-record)

PHPackages © 2026

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