PHP code example of sharkom / yii2-cron

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

    

sharkom / yii2-cron example snippets


// Add namespace to console config:
'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationPath' => [
            '@sharkom/cron/migrations',
        ],
    ],
],

'modules' => [
    'cron' => [
        'class' => 'sharkom\cron\Module',
        'params'=>[
            'sendNotifications'=>true,
        ]
    ],
],

'modules' => [
    'cron' => [
        'class' => 'sharkom\cron\Module',
        'params'=>[
            'sendNotifications'=>true,
        ]
    ],
],

return [
    'senderEmail'=>'[email protected]',
    'NotificationsEmail'=>'[email protected]',
];


'mailer' => [
   'class' => 'yii\swiftmailer\Mailer',
   // send all mails to a file by default. You have to set
   // 'useFileTransport' to false and configure a transport
   // for the mailer to send real emails.
   'useFileTransport' => false,
   'transport' => [
      'class' => 'Swift_SmtpTransport',
      'encryption' => 'tls',
      'host' => 'your smtp relay',
      'port' => '25',
      'username' => 'your user',
      'password' => 'your password',
   ],
],

php composer.phar