PHPackages                             t-kanstantsin/yii2-action-lock-behavior - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. t-kanstantsin/yii2-action-lock-behavior

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

t-kanstantsin/yii2-action-lock-behavior
=======================================

Allow run only one action instance at once

2.0.0(7y ago)0387BSD-3-ClausePHPPHP &gt;=7.1

Since Jul 8Pushed 7y agoCompare

[ Source](https://github.com/t-kanstantsin/yii2-action-lock-behavior)[ Packagist](https://packagist.org/packages/t-kanstantsin/yii2-action-lock-behavior)[ Docs](https://github.com/t-kanstantsin/yii2-action-lock-behavior)[ RSS](/packages/t-kanstantsin-yii2-action-lock-behavior/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

Yii Action lock behavior
========================

[](#yii-action-lock-behavior)

Yii widget

[![Latest Stable Version](https://camo.githubusercontent.com/b805b96b5814e8bf96584e422a81d53ba41485dbf759247486e21f46b7d3f4df/68747470733a2f2f706f7365722e707567782e6f72672f742d6b616e7374616e7473696e2f796969322d616374696f6e2d6c6f636b2d6265686176696f722f762f737461626c652e706e67)](https://packagist.org/packages/t-kanstantsin/yii2-action-lock-behavior)[![Total Downloads](https://camo.githubusercontent.com/f47bacd35dee73ba1105ded313bf8439beae1abf16a5d25b1acee11f3add6c4f/68747470733a2f2f706f7365722e707567782e6f72672f742d6b616e7374616e7473696e2f796969322d616374696f6e2d6c6f636b2d6265686176696f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/t-kanstantsin/yii2-action-lock-behavior)

Basic
-----

[](#basic)

Behavior allow deny multiple runs of same console application action (e.g. long time executing task initiated with cron) using `yii\mutex\*` package.

Lock source should be chosen carefully noting following:

- `yii\mutex\FileMutex` simple but can be used *only with one docker container instance* because its not possible determine if process still running or ended in another container. Requires only writable directory
- `yii\mutex\DbMutex` requires db connection. May be used only with single database instance.

Example
-------

[](#example)

Using mutex from global config:

```
    public function behaviors(): array
    {
        return [
            'pid' => ActionLockBehavior::class,
        ];
    }
```

Define mutex on-the-fly:

```
    public function behaviors(): array
    {
        return [
            'pid' => [
                'class' => ActionLockBehavior::class,
                'mutex' => [
                    'class' => FileMutex::class,
                    'mutexPath' => \Yii::getAlias('@runtime/pid'),
                ],
            ],
        ];
    }
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

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

Recently: every ~54 days

Total

7

Last Release

2695d ago

Major Versions

1.4.1 → 2.0.02019-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/d4163e3f004a6097faad7270c284f429841e2a3d66db295c386d646181e6fd0a?d=identicon)[tkanstantsin](/maintainers/tkanstantsin)

---

Top Contributors

[![k-timoshenko](https://avatars.githubusercontent.com/u/3259675?v=4)](https://github.com/k-timoshenko "k-timoshenko (13 commits)")

---

Tags

yii2Behavior

### Embed Badge

![Health badge](/badges/t-kanstantsin-yii2-action-lock-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/t-kanstantsin-yii2-action-lock-behavior/health.svg)](https://phpackages.com/packages/t-kanstantsin-yii2-action-lock-behavior)
```

###  Alternatives

[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k49](/packages/ecotone-ecotone)[baibaratsky/yii2-serialized-attributes-behavior

Yii2 Serialized Attributes Behavior

1275.5k9](/packages/baibaratsky-yii2-serialized-attributes-behavior)[mdmsoft/yii2-autonumber

Auto number extension for the Yii framework

1831.3k](/packages/mdmsoft-yii2-autonumber)[dagger/dagger

Dagger PHP SDK

261.1k](/packages/dagger-dagger)[valentinek/yii2-closure-table-behavior

This extension allows you to get functional for closure table trees.

1615.5k](/packages/valentinek-yii2-closure-table-behavior)[v0lume/yii2-meta-tags

DB based model meta data for SEO

194.1k](/packages/v0lume-yii2-meta-tags)

PHPackages © 2026

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