1. Go to this page and download the library: Download citomni/jobrunner 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/ */
citomni / jobrunner example snippets
\CitOmni\JobRunner\Operation\StartJob
$result = (new \CitOmni\JobRunner\Operation\StartJob($this->app))->execute(
'commerce.import_products',
[
'source_key' => 'supplier-a',
],
'commerce.import_products:supplier-a',
'Import supplier A products'
);
declare(strict_types=1);
namespace App\JobRunner;
use CitOmni\JobRunner\Contract\JobHandlerInterface;
use CitOmni\JobRunner\Value\JobContext;
final class ImportProductsJobHandler implements JobHandlerInterface {
public function run(JobContext $context): array {
$payload = $context->payload();
$sourceKey = (string)($payload['source_key'] ?? '');
if ($sourceKey === '') {
throw new \InvalidArgumentException('Payload source_key is