lliure / processqueue
Package for task scheduling processing in PHP extended from the lliure model
    v1.3.1
    2022-08-12 15:01 UTC
Requires
- php: >=7.4 || >= 8.0
- lliure/lliure-core: ^v5.3 || ^v6
README
Class with the function of simply managing a process queue using the lliure-core Model
How to create the model?
namespace \Models;
use ProcessQueue\ProcessQueueModel;
class Queue extends ProcessQueueModel
{
    protected static array $fields = ['id', 'attempts']; // define your fields, is required to have id and attempts fields
    protected static ?string $table = 'queue'; // define your table
    protected static $attempts = 5; // opcional, set maximum attempts 
}
How to use?
$processes = Queue::getProcess(); //capturing available processes
foreach ($processes as $process){
    $process->start(); // starting the process
    if($myteste){
        $process->confirmProcess(); //confirming a process
    } else {
        $process->errorProcess('Erro of process'); //reporting an error
    }
}