Documentation

Cron
in package

Cron class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
2.1.0

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
string

between()

Set job schedule to between two hours

public between(int $start, int $end) : Cron
Parameters
$start : int
$end : int
Return values
Cron

create()

Factory

public static create([string|null $schedule = null ]) : Cron
Parameters
$schedule : string|null = null
Return values
Cron

daily()

Set job schedule to daily (alias to hours)

public daily(mixed $hours[, mixed $minutes = null ]) : Cron
Parameters
$hours : mixed
$minutes : mixed = null
Return values
Cron

dailyAt()

Set job schedule to daily at specific time, i.e. 14:30

public dailyAt(string $time) : Cron
Parameters
$time : string
Return values
Cron

evaluate()

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
throws
Exception
Return values
bool

every10Minutes()

Set job schedule to every 10 minutes

public every10Minutes() : Cron
Return values
Cron

every10Seconds()

Set job schedule to every 10 seconds

public every10Seconds() : Cron
Return values
Cron

every15Minutes()

Set job schedule to every 15 minutes

public every15Minutes() : Cron
Return values
Cron

every15Seconds()

Set job schedule to every 15 seconds

public every15Seconds() : Cron
Return values
Cron

every20Minutes()

Set job schedule to every 20 minutes

public every20Minutes() : Cron
Return values
Cron

every20Seconds()

Set job schedule to every 20 seconds

public every20Seconds() : Cron
Return values
Cron

every30Minutes()

Set job schedule to every 30 minutes

public every30Minutes() : Cron
Return values
Cron

every30Seconds()

Set job schedule to every 30 seconds

public every30Seconds() : Cron
Return values
Cron

every5Minutes()

Set job schedule to every 5 minutes

public every5Minutes() : Cron
Return values
Cron

every5Seconds()

Set job schedule to every 5 seconds

public every5Seconds() : Cron
Return values
Cron

everyMinute()

Set job schedule to every minute

public everyMinute() : Cron
Return values
Cron

everySecond()

Set job schedule to every second

public everySecond() : Cron
Return values
Cron

fridays()

Set job schedule to Fridays

public fridays() : Cron
Return values
Cron

getBuffer()

Get buffer

public getBuffer() : int
Return values
int

getDaysOfTheMonth()

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|null

getSeconds()

Get seconds

public getSeconds() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasSchedule()

Has schedule string

public hasSchedule() : bool
Return values
bool

hasSeconds()

Has seconds

public hasSeconds() : bool
Return values
bool

hourly()

Set job schedule to hourly

public hourly([mixed $minutes = null ]) : Cron
Parameters
$minutes : mixed = null
Return values
Cron

hours()

Set job schedule to by specific hours

public hours(mixed $hours[, mixed $minutes = null ]) : Cron
Parameters
$hours : mixed
$minutes : mixed = null
Return values
Cron

minutes()

Set job schedule to by specific minutes

public minutes(mixed $minutes) : Cron
Parameters
$minutes : mixed
Return values
Cron

mondays()

Set job schedule to Mondays

public mondays() : Cron
Return values
Cron

monthly()

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
Cron

quarterly()

Set job schedule to quarterly

public quarterly([mixed $hours = null ][, mixed $minutes = null ]) : Cron
Parameters
$hours : mixed = null
$minutes : mixed = null
Return values
Cron

render()

Render the cron schedule string

public render() : string
Return values
string

saturdays()

Set job schedule to Saturdays

public saturdays() : Cron
Return values
Cron

schedule()

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
Cron

seconds()

Set job schedule to by specific seconds

public seconds(mixed $seconds) : Cron
Parameters
$seconds : mixed
Return values
Cron

setBuffer()

Set buffer

public setBuffer(int $buffer) : Cron
Parameters
$buffer : int
Return values
Cron

sundays()

Set job schedule to Sundays

public sundays() : Cron
Return values
Cron

thursdays()

Set job schedule to Thursdays

public thursdays() : Cron
Return values
Cron

tuesdays()

Set job schedule to Tuesdays

public tuesdays() : Cron
Return values
Cron

updateSchedule()

Update cron schedule

public updateSchedule() : Cron
Return values
Cron

wednesdays()

Set job schedule to Wednesdays

public wednesdays() : Cron
Return values
Cron

weekdays()

Set job schedule to weekdays

public weekdays() : Cron
Return values
Cron

weekends()

Set job schedule to weekends

public weekends() : Cron
Return values
Cron

weekly()

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
Cron

yearly()

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
Cron

evaluateExpression()

Determine if the value satisfies the schedule expression

protected evaluateExpression(string $expression, mixed $value) : bool
Parameters
$expression : string
$value : mixed
Return values
bool

        
On this page

Search results