PHP code example of connectholland / tactician-scheduler-plugin

1. Go to this page and download the library: Download connectholland/tactician-scheduler-plugin 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/ */

    

connectholland / tactician-scheduler-plugin example snippets


// create your other middleware
$middleware[] = new SchedulerMiddleware(new FileBasedScheduler($pathWhereTheSchedulerMayKeepItsFiles) );
// create your other middleware
$commandbus = new CommandBus($middleware);

class SayHappyNewYear extends AbstractScheduledCommand
{
    private $message;

    public function __construct($message)
    {
        $this->message = $message;
    }

    public function getMessage() 
    {
        return $this->message;
    }
}

$myScheduledCommand = new SayHappyNewYear('Happy New Year');
$myScheduledCommand->setTimestamp(strtotime('2016-01-01 0:00:00') );
$myCommandBus->handle($myScheduledCommand);

// setup any environment you need
// create your other middleware
$middleware[] = new SchedulerMiddleware(new FileBasedScheduler($pathWhereTheSchedulerMayKeepItsFiles) );
// create your other middleware
$commandbus = new CommandBus($middleware);
return $commandbus;
bash
* * * * *   www-data    vendor/bin/scheduler scheduler:execute bootstrap.php
bash
vendor/bin/scheduler scheduler:daemon bootstrap.php 10
bash
vendor/bin/scheduler scheduler:daemon bootstrap.php 10 6