PHPackages                             zhenxxin/yii-auto-lock - 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. [CLI &amp; Console](/categories/cli)
4. /
5. zhenxxin/yii-auto-lock

ActiveLibrary[CLI &amp; Console](/categories/cli)

zhenxxin/yii-auto-lock
======================

Auto lock when processing command actioins.

v0.0.2(9y ago)08MITPHPPHP &gt;=5.4

Since Feb 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/zhenxxin/yii-autolock)[ Packagist](https://packagist.org/packages/zhenxxin/yii-auto-lock)[ RSS](/packages/zhenxxin-yii-auto-lock/feed)WikiDiscussions master Synced yesterday

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

yii-autolock
============

[](#yii-autolock)

自动为当前命令程序加锁，从而使其以单进程的方式运行。

使用方法
----

[](#使用方法)

1. 下载源代码，放入 components 目录；
2. 使你的子类继承自该类即可。

> 注意：项目配置中，需要设置 import 来将 components 目录的类加载进来。

### 参考样例

[](#参考样例)

`config/main.php` 中增加如下配置，并将 `AutoLockCommand.php` 放入 `components` 目录：

```
'import' => [
    'application.components.*',
],
```

编写需要应用自动加锁机制的业务代码：

```
