Created
April 6, 2014 15:06
-
-
Save mbrevda/10007235 to your computer and use it in GitHub Desktop.
Example of Software defined crons (SlatedHandler)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Framework; | |
class SlatedHandler | |
{ | |
/** | |
* @var Framework\App | |
*/ | |
private $app; | |
public function __construct($app) | |
{ | |
$this->app = $app; | |
// run this anonymous function everytime Slated is run | |
$this->app->at('* * * * *', function () { | |
echo 'foo' . PHP_EOL; | |
}); | |
// run this callable every tuesday (at midnight) | |
$this->app->at('* * * * 2', [$this, 'someFunction']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment