ExpressionAware
- Full name:
\Codefy\Framework\Scheduler\Traits\ExpressionAware
Properties
expression
fieldsPosition
Position of cron fields.
Methods
cron
The Cron expression representing the task's frequency.
Parameters:
Parameter | Type | Description |
---|---|---|
$expression | string |
Throws:
filtersPass
Determine if the filters pass.
between
Schedule task to run between start and end time.
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | string | |
$endTime | string |
unlessBetween
Schedule task that doesn't fall between start and end time.
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | string | |
$endTime | string |
inTimeInterval
Schedule task to run between start and end time.
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | string | |
$endTime | string |
hourly
Schedule the task to run hourly.
Parameters:
Parameter | Type | Description |
---|---|---|
$minute | int|string |
Throws:
daily
Schedule the task to run daily.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
on
Schedule the task to run on a certain date.
Parameters:
Parameter | Type | Description |
---|---|---|
$date | string |
Throws:
at
Schedule the command at a given time.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
dailyAt
Schedule the task to run daily at a given time (10:00, 19:30, etc).
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
twiceDaily
Schedule the task to run twice daily.
Parameters:
Parameter | Type | Description |
---|---|---|
$first | int | First hour. |
$second | int | Second hour. |
Throws:
twiceDailyAt
Schedule the task to run twice daily at a given minute.
Parameters:
Parameter | Type | Description |
---|---|---|
$first | int | First hour. |
$second | int | Second hour. |
$minute | int | Minute. |
Throws:
weekdays
Schedule the task to run only on weekdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
weekends
Schedule the task to run only on weekdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
mondays
Schedule the task to run only on Mondays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
tuesdays
Schedule the task to run only on Tuesdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
wednesdays
Schedule the task to run only on Wednesdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
thursdays
Schedule the task to run only on Thursdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
fridays
Schedule the task to run only on Fridays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
saturdays
Schedule the task to run only on Saturdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
sundays
Schedule the task to run only on Sundays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
weekly
Schedule the task to run weekly.
Throws:
weeklyOn
Schedule the task to run weekly on a given day and time.
Parameters:
Parameter | Type | Description |
---|---|---|
$day | int|string | |
$time | string |
Throws:
monthly
Schedule the task to run monthly.
Throws:
monthlyOn
Schedule the task to run monthly on a given day and time.
Parameters:
Parameter | Type | Description |
---|---|---|
$dayOfMonth | int|string | |
$time | string |
Throws:
lastDayOfTheMonth
Schedule the task to run monthly on a given day and time.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | string |
Throws:
quarterly
Schedule the task to run quarterly.
Parameters:
Parameter | Type | Description |
---|---|---|
$day | int|string|array | |
$time | ?string |
Throws:
yearly
Schedule the task to run yearly.
Throws:
yearlyOn
Schedule the task to run yearly.
Parameters:
Parameter | Type | Description |
---|---|---|
$month | int | |
$day | int | |
$time | ?string |
Throws:
days
Set the days of the week the command should run on.
Parameters:
Parameter | Type | Description |
---|---|---|
$days | mixed |
Throws:
hour
Set hour for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
minute
Set minute for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
dayOfMonth
Set day of the month for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
month
Set month for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
dayOfWeek
Set dah of the week for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
timezone
Set the timezone the date should be evaluated on.
Parameters:
Parameter | Type | Description |
---|---|---|
$timezone | \DateTimeZone|string |
every
Another way to the frequency of the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$unit | string|null | (minute, hour, day, month or weekday) |
$value | float|int|null |
Throws:
everyMinute
Schedule task to run every minute of every $minute minutes.
Parameters:
Parameter | Type | Description |
---|---|---|
$minute | string|int |
Throws:
everyHour
Schedule task to run every hour or every $hour hour and $minute minutes.
Parameters:
Parameter | Type | Description |
---|---|---|
$hour | string|int | |
$minute | int |
Throws:
expressionPasses
Determine if the Cron expression passes.
Parameters:
Parameter | Type | Description |
---|---|---|
$timezone | string|\DateTimeZone|null |
Throws:
spliceIntoPosition
Splice the given value into the given position of the expression.
Parameters:
Parameter | Type | Description |
---|---|---|
$position | int | |
$value | string |
Throws:
setDayOfWeek
Internal function used by the everyMonday, etc functions.
Parameters:
Parameter | Type | Description |
---|---|---|
$day | int|string | |
$time | ?string |
Throws:
parseTime
Parses a time string (like 4:08 pm) into minutes and hours.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | string |
Automatically generated on 2025-10-13