PHP code example of gofmanaa / yii2-crontask

1. Go to this page and download the library: Download gofmanaa/yii2-crontask library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gofmanaa / yii2-crontask example snippets


return [
    'bootstrap' => [
        'crontask'
    ],
    'modules' => [
        'crontask' => [
            'class' => 'gofmanaa\crontask\Module',
            'fileName'=>'cron.txt', //optional
            'params'=>[ '2>&1' ], //common params
            'yiiPath' => null // yii execute path
            'phpPath' => '/usr/bin/php', //default php path
            'tasks'=>[
                'dosomething'=>
                            [
                               'params'=>[ '--some=something' , '>/dev/null' ], //task params
                               'command'=>'path/to/controller/action',
                               'min'=>'*/1',
                               'hour'=>'*',
                               'day'=>'*',
                               'month'=>'*',
                               'dayofweek'=>'*',
                            ],
                'dosomething2'=>
                            [
                                'command'=>'path/to/controller/action',
                                'min'=>'*/2',
                            ],
            ]
        ],
    ],
]

php composer.phar