ziya/yii-cron

There is no license information available for the latest version (0.0.0.3) of this package.

Yii cron package

0.0.0.3 2022-05-17 10:34 UTC

This package is auto-updated.

Last update: 2024-05-17 15:14:08 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

composer require ziya/yii-cron

or add

"ziya/yii-cron": "*"

to the require section of your composer.json file.

Configuration

Before using you must migrate

php yii migrate --migrationPath="@vendor/ziya/yii-cron/src/migrations

Usage

Send sms cron

<?php

class SendSmsCron extends \Ziya\YiiCron\BaseCron
{
    public static function key(){
        return 'send_sms_cron'
    }

    public function execute(){
        $sms = new Sms();
        $sms->phone_number = 123456789;
        $sms->body = "Hello world !";
        $sms->send();
    }
}
?>

Running crons

<?php

$list = [
    SendSmsCron::class
];


$cron = new \Ziya\YiiCron\CronList($list);
$cron->execute();
?>