Download the PHP package philiprehberger/cron-expression-builder without Composer
On this page you can find all versions of the php package philiprehberger/cron-expression-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download philiprehberger/cron-expression-builder
More information about philiprehberger/cron-expression-builder
Files in philiprehberger/cron-expression-builder
Package cron-expression-builder
Short Description Fluent cron expression builder with human-readable methods
License MIT
Homepage https://github.com/philiprehberger/cron-expression-builder
Informations about the package cron-expression-builder
PHP Cron Expression Builder
Fluent cron expression builder with human-readable methods.
Requirements
- PHP 8.2+
Installation
Usage
Static Shortcuts
Use the Cron class for common schedules:
Preset Intervals
Use builder presets for common intervals:
Custom Builder
Build complex expressions with the fluent builder:
The builder implements Stringable, so you can use it directly in string contexts:
Next Run Date
Calculate the next execution time from a cron expression:
Next N Run Dates
Calculate multiple upcoming execution times:
Overlap Detection
Check if cron schedules produce overlapping execution times:
Interval Analysis
Analyze the timing intervals between cron runs:
Validator
Validate cron expression syntax:
Describer
Get human-readable descriptions:
API
| Method | Returns | Description |
|---|---|---|
Cron::everyMinute() |
string |
Every minute (* * * * *) |
Cron::everyFiveMinutes() |
string |
Every 5 minutes (*/5 * * * *) |
Cron::everyTenMinutes() |
string |
Every 10 minutes (*/10 * * * *) |
Cron::everyFifteenMinutes() |
string |
Every 15 minutes (*/15 * * * *) |
Cron::everyThirtyMinutes() |
string |
Every 30 minutes (*/30 * * * *) |
Cron::hourly() |
string |
Every hour at :00 (0 * * * *) |
Cron::hourlyAt(int $minute) |
string |
Every hour at given minute |
Cron::daily() |
string |
Every day at midnight (0 0 * * *) |
Cron::dailyAt(string $time) |
string |
Every day at HH:MM |
Cron::weekly() |
string |
Every Sunday at midnight |
Cron::weeklyOn(int $day, string $time) |
string |
Weekly on given day at time |
Cron::monthly() |
string |
First of month at midnight |
Cron::monthlyOn(int $day, string $time) |
string |
Monthly on given day at time |
Cron::yearly() |
string |
January 1st at midnight |
Cron::custom() |
CronBuilder |
Start fluent builder |
CronBuilder::everyQuarterHour() |
self |
Set minute to */15 |
CronBuilder::everyHalfHour() |
self |
Set minute to */30 |
CronBuilder::weeklyOnDay(string $dayName) |
self |
Set day of week by English name |
CronExpression::nextRunDate(?DateTimeInterface $from) |
DateTimeImmutable |
Next execution time |
CronExpression::nextRuns(int $count, ?DateTimeInterface $from) |
array |
Next N execution times |
CronScheduler::nextRuns(string\|CronExpression $expr, int $count, ?DateTimeInterface $from) |
array |
Next N run dates |
CronScheduler::overlaps(string\|CronExpression $a, string\|CronExpression $b, int $windowHours, ?DateTimeInterface $from) |
bool |
Check if two schedules overlap |
CronScheduler::findOverlaps(array $expressions, int $windowHours, ?DateTimeInterface $from) |
array |
Find all overlapping pairs |
CronInterval::averageInterval(string\|CronExpression $expr, int $sampleSize, ?DateTimeInterface $from) |
float |
Average seconds between runs |
CronInterval::minInterval(string\|CronExpression $expr, int $sampleSize, ?DateTimeInterface $from) |
float |
Minimum seconds between runs |
CronInterval::maxInterval(string\|CronExpression $expr, int $sampleSize, ?DateTimeInterface $from) |
float |
Maximum seconds between runs |
CronValidator::isValid(string $expr) |
bool |
Validate cron syntax |
CronDescriber::describe(string $expr) |
string |
Human-readable description |
Development
Support
If you find this project useful:
License
MIT