PHP code example of justinholtweb / craft-alarmclock

1. Go to this page and download the library: Download justinholtweb/craft-alarmclock 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/ */

    

justinholtweb / craft-alarmclock example snippets


use justinholtweb\alarmclock\services\Ticker;
use justinholtweb\alarmclock\events\TransitionEvent;
use yii\base\Event;

Event::on(Ticker::class, Ticker::EVENT_AFTER_TRANSITION, function(TransitionEvent $event) {
    // Fires once, the first time a crossing is noticed.
    // $event->transition, $event->element (null if it has since been deleted)
});
cron
* * * * * cd /path/to/site && php craft alarm-clock/tick
sh
php craft alarm-clock/schedule/draft <draftId> "2026-09-01 09:00" --enable
php craft alarm-clock/schedule/list
php craft alarm-clock/schedule/cancel <id>
sh
php craft alarm-clock/tick/status