Download the PHP package rumur/wp-scheduling without Composer
On this page you can find all versions of the php package rumur/wp-scheduling. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rumur/wp-scheduling
More information about rumur/wp-scheduling
Files in rumur/wp-scheduling
Package wp-scheduling
Short Description The OOP package to work with WordPress cron
License MIT
Homepage https://github.com/rumur/wp-scheduling
Informations about the package wp-scheduling
wp-scheduling
it's a package that provides a convenient way of working with a WordPress Cron functionality.
Package Installation
Themosis 2.x
Sage 10.x
Minimum Requirements:
- PHP: 7.2+
- WordPress: 5.3+
How to use it?
Task as a Class
.
In order to use a specific class as a Job, you can create any class you want, but this class must have public
handle
method
Task as a Closure
, the call
method takes any callable
instance.
Task as a function.
In order to set a task as function, you need to implement that function first and as far as the Schedule::call
takes any callable
instance you just call it.
Available recurrence
Note that these methods should be the last one in the chain, because it registers all options that was build for a task.
Recurrence | Description |
---|---|
->runEveryMinute(); |
Register the task to run every minute |
->runEveryFiveMinutes(); |
Register the task to run every five minutes |
->runEveryTenMinutes(); |
Register the task to run every ten minutes |
->runEveryFifteenMinutes(); |
Register the task to run every fifteen minutes |
->runEveryThirtyMinutes(); |
Register the task to run every thirty minutes |
->runHourly(); |
Register the task to run every hour |
->runDaily(); |
Register the task to run every day |
->runWeekly(); |
Register the task to run every week |
->runMonthly(); |
Register the task to run every month |
->runQuarterly(); |
Register the task to run every quarter |
->runYearly(); |
Register the task to run every year |
->runOnceInMinute(); |
Register the task to run only once in minute |
->runOnceInMinutes(45); |
Register the task to run only once in 45 minutes |
->runOnceInFiveMinutes(); |
Register the task to run only once in 5 minutes |
->runOnceInTenMinutes(); |
Register the task to run only once in 10 minutes |
->runOnceInFifteenMinutes(); |
Register the task to run only once in 15 minutes |
->runOnceInThirtyMinutes(); |
Register the task to run only once in 30 minutes |
->runOnceInHour(); |
Register the task to run only once in one hour |
->runOnceInDay(); |
Register the task to run only once in one day |
->runOnceInWeek(); |
Register the task to run only once in one week |
->runOnceInMonth(); |
Register the task to run only once in one month |
->runOnceInQuarter(); |
Register the task to run only once in a quarter |
->runOnceInYear(); |
Register the task to run only once in a year |
->runNow(); |
Runs the task right now. The method mimics WordPress behavior, designed for a testing purpose. |
Available methods
Method | Description |
---|---|
->onFailure(callable $thing); |
Adds listeners for a task that will be run when it's failed. |
->onSuccess(callable $thing); |
Adds listeners for a task that will be run when it's performed. |
->pingOnFailure(string $url); |
Ping the url when the task is failed. |
->pingOnSuccess(string $url); |
Ping the url when the task is successfully performed. |
->with($data); |
The data for a task, that will be passed to Closure or handle method of the task. |
How to add your own intervals?
How to set one task for more than one event?
Every chained method returns a PendingTask
instance and this task might be assigned for a several recurrence.
How to resign a job?
License
This package is licensed under the MIT License - see the LICENSE.md file for details.