PHP code example of ziya / yii-cron

1. Go to this page and download the library: Download ziya/yii-cron 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/ */

    

ziya / yii-cron example snippets





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();
    }
}




$list = [
    SendSmsCron::class
];


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