1. Go to this page and download the library: Download php-alchemist/chrono-smith 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/ */
php-alchemist / chrono-smith example snippets
HPAlchemist\ChronoSmith\Codec\CodecRegistry;
use PHPAlchemist\ChronoSmith\Codec\CS1Codec;
use PHPAlchemist\ChronoSmith\Engine\AdvancementEngine;
use PHPAlchemist\ChronoSmith\Engine\Scheduler;
$registry = new CodecRegistry();
$registry->register(new CS1Codec());
$scheduler = new Scheduler($registry, new AdvancementEngine());
$schedule = $scheduler->hydrate(
'[CS=1;ns=App\Scheduling\BillingScheduler;s=@2026-01-30;i=1m;a=dom30;r=back;stick=dom]',
);
echo $scheduler->nextDue($schedule)?->format('Y-m-d'); // 2026-01-30
$schedule = $scheduler->advance($schedule);
echo $schedule->cursor?->format('Y-m-d'); // 2026-01-30
echo $schedule->nextDueDate?->format('Y-m-d'); // 2026-02-28
$schedule = $scheduler->satisfyNext($schedule, new \DateTimeImmutable('2026-02-25'));
echo $schedule->cursor?->format('Y-m-d'); // 2026-02-28
echo $schedule->lastActualOccurrence?->format('Y-m-d'); // 2026-02-25
echo $schedule->nextDueDate?->format('Y-m-d'); // 2026-03-30
$serialized = $scheduler->serialize($schedule);
$schedule = $scheduler->hydrate('[CS=1;s=@2026-02-01;i=1m;next=@2026-02-01;gr=3d]');
$scheduler->isOverdue($schedule, new \DateTimeImmutable('2026-02-04')); // false
$scheduler->isOverdue($schedule, new \DateTimeImmutable('2026-02-05')); // true