Skip to content

Instantly share code, notes, and snippets.

@mbrevda
Created April 6, 2014 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbrevda/10007235 to your computer and use it in GitHub Desktop.
Save mbrevda/10007235 to your computer and use it in GitHub Desktop.
Example of Software defined crons (SlatedHandler)
<?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