use ThemePlate\Process\Async;
// Instantiate
$background = new Async( function() {
long_running_task();
} );
// Dispatch
$background->dispatch();
Execute a heavy one-off task via a non-blocking request
- $callback_func (callable)(Required) Function to run asynchronously
- $callback_args (array)(Optional) Parameters to pass in the callback. Default
null
Fire off the process in the background instantly
Chainable methods to handle success or error
- $callback (callable)(Optional)
use ThemePlate\Process\Tasks;
$chores = new Tasks( 'my_day' );
$chores->add( 'first_task', array( 'this', 'that' ) );
$chores->add( function() {
another_task();
} );
- $identifier (string)(Required) Unique identifier
- $callback_func (callable)(Required) Function to run
- $callback_args (array)(Optional) Parameters to pass. Default
null
- $callback_func (callable)(Required) Supposed function to run
- $callback_args (array)(Optional) The parameters passed. Default
null
Remove all currently listed task
- $number (int)(Required) Number of task per run
- $second (int)(Required) Interval between runs
- $callback (callable)(Required) To run after completion