1. Go to this page and download the library: Download kinetis/queue library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kinetis / queue example snippets
use Kinetis\Queue\Job;
use Kinetis\Queue\QueueInterface;
final readonly class SendWelcomeEmail implements Job
{
public function __construct(
public string $email,
public string $name,
) {}
public function handle(Mailer $mailer): void
{
$mailer->send($this->email, "Welcome, {$this->name}!");
}
}
$queue->push(new SendWelcomeEmail($email, $name), maxAttempts: 3);
use Kinetis\Queue\QueueInterface;
use Kinetis\QueueSql\SqlQueueFactory;
$queue = SqlQueueFactory::fromConfig($config);
$app->instance(QueueInterface::class, $queue);
$app->onDispose($queue->dispose(...));
use Kinetis\Queue\ClearableQueueInterface;
final readonly class ImportsMaintenance
{
public function __construct(
private ClearableQueueInterface $queue,
) {}
public function discardPendingImports(): int
{
return $this->queue->clear('imports');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.