daydiff/yii2-unique-command

Yii2 command trait and behavior allows you to control uniqueness of command

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

pkg:composer/daydiff/yii2-unique-command

dev-master 2016-11-07 11:57 UTC

This package is not auto-updated.

Last update: 2025-10-12 01:34:28 UTC


README

How to use

use Daydiff\UniqueCommand\UniqueCommandBehavior;
use yii\console\Controller;

class UniqueController extends Controller
{

    public function behaviors()
    {
        return [
            [
                'class' => UniqueCommandBehavior::className(),
                'actions' => ['foo'] //an action foo will be unique
            ]
        ];
    }

    /**
     * Unique action
     */
    public function actionFoo()
    {
        //just if it do really long work
        sleep(5);
        return 'unique';
    }

    /**
     * Non unique action
     */
    public function actionBar()
    {
        //just if it do really long work
        sleep(5);
        return 'non-unique';
    }
}