PHP code example of abuisine / php-afanasy-client
1. Go to this page and download the library: Download abuisine/php-afanasy-client 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/ */
abuisine / php-afanasy-client example snippets
use Afanasy\Network;
$afnetwork = new Network('localhost', 51000);
use Afanasy\Job;
use Afanasy\Block;
use Afanasy\Task;
// Get all jobs
$jobs = $afnetwork->getAllJobs();
// Pause jobs
$jobIds = array_column($jobs['jobs'], 'job_id');
$afnetwork->pauseJobs($jobIds);
// Send a new Job
$job = new Job("Foo");
$block = new Block("Bar");
$task = new Task("FooBar");
$job->addBlock($block);
$block->addTask($task);
$task->setCommand('echo "Hello, World!"');
$afnetwork->sendJob($job);