Download the PHP package futur/udschedule without Composer
On this page you can find all versions of the php package futur/udschedule. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download futur/udschedule
More information about futur/udschedule
Files in futur/udschedule
Package udschedule
Short Description UserDefinableSchedule allows you to create user defined schedule tasks
License MIT
Informations about the package udschedule
UDSchedule
User Definable Schedule is the laravel package which allows you to create user defined schedule tasks.
Installation
Install via composer
Migrate package migration with expressions table
Define scheduler model
... use Futur\UDSchedule\Interfaces\UDSchedulerInterface; use Futur\UDSchedule\Traits\UDScheduler; class User extends Authenticatable implements UDSchedulerInterface { use HasFactory, Notifiable, UDScheduler; ...
Define scheduled class, could be any class implementing UDSchedulable interface, such a model or class stored in folder, etc
... use Futur\UDSchedule\Interfaces\UDSchedulable; use Futur\UDSchedule\Interfaces\UDSchedulerInterface; class Report implements UDSchedulable { public function doUDScheduled(UDSchedulerInterface $UDScheduler) { //Define anything you want to shedule here //Sending email reminders, etc. } ... }
Usage
Scheduling
After installation, everything you need is call UDSchedule facade and define a scheduler and a schedulable with schedule type:
Available schedule types:
-
monthly with any day of a month as a value
-
weekly with any day of a week as a value
-
daily with time (HH:MM) as a value
-
at with time (HH:MM) as a value, to specify time of schedule
-
weekdays
-
weekends
-
lastDayOfMonth
-
custom expression if you want to specify cron expression by your own
- timezone specify timezone of user defining schedule
Expression interpreter
Sometimes it's needed to interpret expressions from udscheduled tasks to understandable look. You can do so using interpretExpression method of UDSchedule facade:
will return: