Repository URL to install this package:
|
Version:
2.2.0 ▾
|
<?php
/**
* This is a very simple usage example intended to show
* the general workflow and configuration.
*
* We will create a job manager and configure a single
* job, which we will then execute.
*
* PS: This file should be run via CLI
*/
require_once __DIR__.'/../vendor/autoload.php';
// instantiate the manager
$jobManager = new \CrazyFactory\Jobs\JobManager();
// add a job configuration. This would normally be done
// by looping over a config array, files in folder, etc. etc.
$jobConfig = new \CrazyFactory\Jobs\JobConfig([
'name' => 'dance',
'cmd' => 'php ' . __DIR__ . '/jobs/dance_job.php',
]);
// Add it to the manager
$jobManager->withJob($jobConfig);
// Execute by name
$jobManager->run('dance');