PHP code example of lordsimal / cakephp-scheduler
1. Go to this page and download the library: Download lordsimal/cakephp-scheduler 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/ */
lordsimal / cakephp-scheduler example snippets
public function bootstrap()
{
parent::bootstrap();
$this->addPlugin(\CakeScheduler\CakeSchedulerPlugin::class);
}
namespace App;
use App\Command\MyAppCommand;
use App\Command\OtherAppCommand;
use Cake\Http\BaseApplication;
use CakeScheduler\CakeSchedulerInterface;
use CakeScheduler\Scheduler\Scheduler;
class Application extends BaseApplication implements CakeSchedulerInterface
{
public function schedule(Scheduler &$scheduler): void
{
$scheduler->execute(MyAppCommand::class)->daily();
$scheduler->execute(OtherAppCommand::class, ['somearg', '--myoption=someoption'])->daily();
}
}