PHP code example of chesszebra / jobsystem

1. Go to this page and download the library: Download chesszebra/jobsystem 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/ */

    

chesszebra / jobsystem example snippets




// For this example we use Pheanstalk
$connection = new Pheanstalk\Pheanstalk('localhost');

// The storage to store jobs in
$storage = new ChessZebra\JobSystem\Storage\Pheanstalk($connection);
$storage->addJob(new \ChessZebra\JobSystem\Job\Job('my-worker', [
    'some' => 'parameter',
]));



// For this example we use Pheanstalk
$connection = new Pheanstalk\Pheanstalk('localhost');

// The storage where we retrieve jobs from.
$storage = new ChessZebra\JobSystem\Storage\Pheanstalk($connection);

// Setup a logger which is used to write information
$logger = ...; // Any PSR-3 compatible logger.

// A container with all workers
$workers = ...; // Any PSR-11 compatible container.

// Now create the client and run it. 
$client = new ChessZebra\JobSystem\Client($storage, $logger, $workers);
$client->run();