2017 © Pedro Peláez
 

yii2-extension yii2-cronjobs

cronjobs

image

denisogr/yii2-cronjobs

cronjobs

  • Wednesday, May 17, 2017
  • by DenisOgr
  • Repository
  • 13 Watchers
  • 43 Stars
  • 8,825 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 31 Forks
  • 5 Open issues
  • 1 Versions
  • 8 % Grown

The README.md

Yii2 cronjobs extension

Easiest way to put crontab on your console scripts., (*1)

This extension is based on this. Thanks Yiivgeny., (*2)

But with a few changes: - Work eith yii2 - Set config in params (not in phpDocs)., (*3)

I transfer ​​settings of crontab in local settings(params) configuration, so that the application can be run on different servers with different sets of crontab., (*4)

Installation

  • Step 1: The preferred way to install this extension is through composer.

Either run, (*5)

php composer.phar require --prefer-dist denisogr/yii2-cronjobs "dev-master"

or add, (*6)

"denisogr/yii2-cronjobs": "dev-master"

to the require section of your composer.json file. - Step 2: Set aliase @runnerScript in console config. This absolutely path to runner script (I can not find another way to get runner script). Change path to runner script as your project (For Yii2 Basic application)., (*7)

Yii::setAlias('@runnerScript', dirname(__DIR__) .'/yii');
  • Step 3: Add to console config:
'controllerMap' => [
       'cron' => [
           'class' => 'denisog\cronjobs\CronController'
       ],
   ],
  • Step 4: Add task to system scheduler (cron on unix, task scheduler on windows) to run every minute:
* * * * * /path/to/yii/application/protected/yiic cron

Usage

Add in params array with cron sets:, (*8)

'cronJobs' =>[
        'test/example1' => [
            'cron'      => '* * * * *',            
        ],
    'test/example2' => [
            'cron'      => '10 * * * *',            
        ],

    ],

You can point any settings from this., (*9)

The Versions

17/05 2017

dev-master

9999999-dev

cronjobs

  Sources   Download

BSD-3-Clause

The Requires

 

by Denis Porplenko

extension yii2 cronjobs