1. Go to this page and download the library: Download alancole/atomic 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/ */
alancole / atomic example snippets
# Schedule an event on the first of december each year.
$yearly = new Atomic\Schedule\Yearly(new DateTime("1st December"));
$event = new Atomic\Event("dec-log-clear", $yearly, function() {
Logs::clearAll(); // hypothetical event code.
});
# Some check at a later time
if ($event->isDue()) {
$event->fire();
}
namespace Custom\Schedule;
class EveryWednesday implements \Atomic\Schedule\ScheduleInterface
{
public function __construct(DateTime $time = null)
{
return true;
}
public function getName()
{
return "Every Wednesday";
}
public function getNextRun()
{
return new DateTime("Wednesday");
}
public function getFirstRun()
{
return new DateTime("Wednesday");
}
public function isNow(DateTime $time = null)
{
return date("D") == "Wed";
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.