Cron
in package
Cron class
Tags
Table of Contents
Properties
- $buffer : int
- Time buffer
- $daysOfTheMonth : array<string|int, mixed>
- Days of the month
- $daysOfTheWeek : array<string|int, mixed>
- Days of the week
- $hours : array<string|int, mixed>
- Hours
- $minutes : array<string|int, mixed>
- Minutes
- $months : array<string|int, mixed>
- Months
- $schedule : string|null
- Schedule string
- $seconds : array<string|int, mixed>
- Seconds - Not a standard cron unit of time. The smallest time interval supported by cron is 1 minute.
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- To string method
- between() : Cron
- Set job schedule to between two hours
- create() : Cron
- Factory
- daily() : Cron
- Set job schedule to daily (alias to hours)
- dailyAt() : Cron
- Set job schedule to daily at specific time, i.e. 14:30
- evaluate() : bool
- Evaluate the set cron schedule value against a time value
- every10Minutes() : Cron
- Set job schedule to every 10 minutes
- every10Seconds() : Cron
- Set job schedule to every 10 seconds
- every15Minutes() : Cron
- Set job schedule to every 15 minutes
- every15Seconds() : Cron
- Set job schedule to every 15 seconds
- every20Minutes() : Cron
- Set job schedule to every 20 minutes
- every20Seconds() : Cron
- Set job schedule to every 20 seconds
- every30Minutes() : Cron
- Set job schedule to every 30 minutes
- every30Seconds() : Cron
- Set job schedule to every 30 seconds
- every5Minutes() : Cron
- Set job schedule to every 5 minutes
- every5Seconds() : Cron
- Set job schedule to every 5 seconds
- everyMinute() : Cron
- Set job schedule to every minute
- everySecond() : Cron
- Set job schedule to every second
- fridays() : Cron
- Set job schedule to Fridays
- getBuffer() : int
- Get buffer
- getDaysOfTheMonth() : array<string|int, mixed>
- Get days of the month
- getDaysOfTheWeek() : array<string|int, mixed>
- Get days of the week
- getHours() : array<string|int, mixed>
- Get hours
- getMinutes() : array<string|int, mixed>
- Get minutes
- getMonths() : array<string|int, mixed>
- Get months
- getSchedule() : string|null
- Get schedule string
- getSeconds() : array<string|int, mixed>
- Get seconds
- hasSchedule() : bool
- Has schedule string
- hasSeconds() : bool
- Has seconds
- hourly() : Cron
- Set job schedule to hourly
- hours() : Cron
- Set job schedule to by specific hours
- minutes() : Cron
- Set job schedule to by specific minutes
- mondays() : Cron
- Set job schedule to Mondays
- monthly() : Cron
- Set job schedule to monthly
- quarterly() : Cron
- Set job schedule to quarterly
- render() : string
- Render the cron schedule string
- saturdays() : Cron
- Set job schedule to Saturdays
- schedule() : Cron
- Set cron schedule
- seconds() : Cron
- Set job schedule to by specific seconds
- setBuffer() : Cron
- Set buffer
- sundays() : Cron
- Set job schedule to Sundays
- thursdays() : Cron
- Set job schedule to Thursdays
- tuesdays() : Cron
- Set job schedule to Tuesdays
- updateSchedule() : Cron
- Update cron schedule
- wednesdays() : Cron
- Set job schedule to Wednesdays
- weekdays() : Cron
- Set job schedule to weekdays
- weekends() : Cron
- Set job schedule to weekends
- weekly() : Cron
- Set job schedule to weekly
- yearly() : Cron
- Set job schedule to yearly
- evaluateExpression() : bool
- Determine if the value satisfies the schedule expression
Properties
$buffer
Time buffer
protected
int
$buffer
= 0
$daysOfTheMonth
Days of the month
protected
array<string|int, mixed>
$daysOfTheMonth
= []
$daysOfTheWeek
Days of the week
protected
array<string|int, mixed>
$daysOfTheWeek
= []
$hours
Hours
protected
array<string|int, mixed>
$hours
= []
$minutes
Minutes
protected
array<string|int, mixed>
$minutes
= []
$months
Months
protected
array<string|int, mixed>
$months
= []
$schedule
Schedule string
protected
string|null
$schedule
= null
$seconds
Seconds - Not a standard cron unit of time. The smallest time interval supported by cron is 1 minute.
protected
array<string|int, mixed>
$seconds
= []
This is to support time intervals less than minute and down to 1 second.
Methods
__construct()
Constructor
public
__construct([string|null $schedule = null ][, int $buffer = 0 ]) : mixed
Instantiate the cron object
Parameters
- $schedule : string|null = null
- $buffer : int = 0
__toString()
To string method
public
__toString() : string
Return values
stringbetween()
Set job schedule to between two hours
public
between(int $start, int $end) : Cron
Parameters
- $start : int
- $end : int
Return values
Croncreate()
Factory
public
static create([string|null $schedule = null ]) : Cron
Parameters
- $schedule : string|null = null
Return values
Crondaily()
Set job schedule to daily (alias to hours)
public
daily(mixed $hours[, mixed $minutes = null ]) : Cron
Parameters
- $hours : mixed
- $minutes : mixed = null
Return values
CrondailyAt()
Set job schedule to daily at specific time, i.e. 14:30
public
dailyAt(string $time) : Cron
Parameters
- $time : string
Return values
Cronevaluate()
Evaluate the set cron schedule value against a time value
public
evaluate([mixed $time = null ][, int|null $buffer = null ]) : bool
$buffer = 0; strict evaluation to the 00 second $buffer = 1-59; gives up to a minute buffer to account for any delay in processing $buffer = -1; disregards the seconds value for a loose evaluation
Parameters
- $time : mixed = null
- $buffer : int|null = null
Tags
Return values
boolevery10Minutes()
Set job schedule to every 10 minutes
public
every10Minutes() : Cron
Return values
Cronevery10Seconds()
Set job schedule to every 10 seconds
public
every10Seconds() : Cron
Return values
Cronevery15Minutes()
Set job schedule to every 15 minutes
public
every15Minutes() : Cron
Return values
Cronevery15Seconds()
Set job schedule to every 15 seconds
public
every15Seconds() : Cron
Return values
Cronevery20Minutes()
Set job schedule to every 20 minutes
public
every20Minutes() : Cron
Return values
Cronevery20Seconds()
Set job schedule to every 20 seconds
public
every20Seconds() : Cron
Return values
Cronevery30Minutes()
Set job schedule to every 30 minutes
public
every30Minutes() : Cron
Return values
Cronevery30Seconds()
Set job schedule to every 30 seconds
public
every30Seconds() : Cron
Return values
Cronevery5Minutes()
Set job schedule to every 5 minutes
public
every5Minutes() : Cron
Return values
Cronevery5Seconds()
Set job schedule to every 5 seconds
public
every5Seconds() : Cron
Return values
CroneveryMinute()
Set job schedule to every minute
public
everyMinute() : Cron
Return values
CroneverySecond()
Set job schedule to every second
public
everySecond() : Cron
Return values
Cronfridays()
Set job schedule to Fridays
public
fridays() : Cron
Return values
CrongetBuffer()
Get buffer
public
getBuffer() : int
Return values
intgetDaysOfTheMonth()
Get days of the month
public
getDaysOfTheMonth() : array<string|int, mixed>
Return values
array<string|int, mixed>getDaysOfTheWeek()
Get days of the week
public
getDaysOfTheWeek() : array<string|int, mixed>
Return values
array<string|int, mixed>getHours()
Get hours
public
getHours() : array<string|int, mixed>
Return values
array<string|int, mixed>getMinutes()
Get minutes
public
getMinutes() : array<string|int, mixed>
Return values
array<string|int, mixed>getMonths()
Get months
public
getMonths() : array<string|int, mixed>
Return values
array<string|int, mixed>getSchedule()
Get schedule string
public
getSchedule() : string|null
Return values
string|nullgetSeconds()
Get seconds
public
getSeconds() : array<string|int, mixed>
Return values
array<string|int, mixed>hasSchedule()
Has schedule string
public
hasSchedule() : bool
Return values
boolhasSeconds()
Has seconds
public
hasSeconds() : bool
Return values
boolhourly()
Set job schedule to hourly
public
hourly([mixed $minutes = null ]) : Cron
Parameters
- $minutes : mixed = null
Return values
Cronhours()
Set job schedule to by specific hours
public
hours(mixed $hours[, mixed $minutes = null ]) : Cron
Parameters
- $hours : mixed
- $minutes : mixed = null
Return values
Cronminutes()
Set job schedule to by specific minutes
public
minutes(mixed $minutes) : Cron
Parameters
- $minutes : mixed
Return values
Cronmondays()
Set job schedule to Mondays
public
mondays() : Cron
Return values
Cronmonthly()
Set job schedule to monthly
public
monthly(mixed $day[, mixed $hours = null ][, mixed $minutes = null ]) : Cron
Parameters
- $day : mixed
- $hours : mixed = null
- $minutes : mixed = null
Return values
Cronquarterly()
Set job schedule to quarterly
public
quarterly([mixed $hours = null ][, mixed $minutes = null ]) : Cron
Parameters
- $hours : mixed = null
- $minutes : mixed = null
Return values
Cronrender()
Render the cron schedule string
public
render() : string
Return values
stringsaturdays()
Set job schedule to Saturdays
public
saturdays() : Cron
Return values
Cronschedule()
Set cron schedule
public
schedule(string $schedule) : Cron
min hour dom month dow
- OR non-standard -
sec min hour dom month dow
Parameters
- $schedule : string
Return values
Cronseconds()
Set job schedule to by specific seconds
public
seconds(mixed $seconds) : Cron
Parameters
- $seconds : mixed
Return values
CronsetBuffer()
Set buffer
public
setBuffer(int $buffer) : Cron
Parameters
- $buffer : int
Return values
Cronsundays()
Set job schedule to Sundays
public
sundays() : Cron
Return values
Cronthursdays()
Set job schedule to Thursdays
public
thursdays() : Cron
Return values
Crontuesdays()
Set job schedule to Tuesdays
public
tuesdays() : Cron
Return values
CronupdateSchedule()
Update cron schedule
public
updateSchedule() : Cron
Return values
Cronwednesdays()
Set job schedule to Wednesdays
public
wednesdays() : Cron
Return values
Cronweekdays()
Set job schedule to weekdays
public
weekdays() : Cron
Return values
Cronweekends()
Set job schedule to weekends
public
weekends() : Cron
Return values
Cronweekly()
Set job schedule to weekly
public
weekly(mixed $day[, mixed $hours = null ][, mixed $minutes = null ]) : Cron
Parameters
- $day : mixed
- $hours : mixed = null
- $minutes : mixed = null
Return values
Cronyearly()
Set job schedule to yearly
public
yearly([bool $endOfYear = false ][, mixed $hours = null ][, mixed $minutes = null ]) : Cron
Parameters
- $endOfYear : bool = false
- $hours : mixed = null
- $minutes : mixed = null
Return values
CronevaluateExpression()
Determine if the value satisfies the schedule expression
protected
evaluateExpression(string $expression, mixed $value) : bool
Parameters
- $expression : string
- $value : mixed