Crontab syntax
This library reads a standard five-field crontab schedule at the start of each line:
* * * * * command
| | | | |
| | | | +-- day of week
| | | +---- month
| | +------ day of month
| +-------- hour
+---------- minute
The command starts after the fifth field.
Basic examples
* * * * * hello
0 * * * * printf 'Top of the hour\n'
30 9 * * 1-5 App\Task\Digest::send
0 0 1 * * php bin/monthly-report.php
Comments and blank lines
Blank lines are ignored.
Lines beginning with # are also ignored:
# This is a comment.
*/10 * * * * hello
Lists, ranges, and steps
The field parser supports the usual cron building blocks:
*for “any value”?for “any value”1,3,5for a list9-17for a range*/15for a step1-10/2for a stepped range
Examples:
*/15 * * * * example("every 15 minutes")
0 9-17 * * 1-5 example("every hour from 9 through 17, Monday through Friday")
0 8,12,18 * * * example("hour 8, 12, and 18")
Month and weekday names
Month and weekday fields may use short English names:
0 22 * JAN MON-FRI hello
Supported month names:
JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
Supported weekday names:
MONTUEWEDTHUFRISATSUN
The numeric weekday values 0 and 7 both mean Sunday.
Nicknames
The library also accepts these nickname expressions:
@yearly@annually@monthly@weekly@daily@hourly
Example:
@daily App\Task\Cleanup::run
Day-of-month and day-of-week behaviour
Cron has one important rule that often surprises people: when both the day-of-month and day-of-week fields are restricted, they use OR semantics.
For example:
0 12 13 * FRI hello
This runs at noon on:
- every 13th day of the month
- every Friday
It does not require both conditions to match at the same time.
Second-precision extension
This library adds one non-standard extension: the first field may use an s suffix to mean seconds within the matching minute.
*/10s * * * * hello
That expression runs every 10 seconds.
This is useful for local development, short-running workers, or projects where minute precision is not enough.
Validating a file
To check syntax without running anything:
vendor/bin/cron --validate
If the file is valid, the command prints Syntax OK with the resolved file path.
Now that the schedule format is clear, continue with Running the runner.