Skip to content

Faktory job queue library for PHP. Compatible with PHP 5.6

License

Notifications You must be signed in to change notification settings

scrofungulus/faktory_worker_php5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Faktory PHP 5 Library

Faktory job queue library for PHP. Compatible with PHP 5.6 (and maybe lower, but untested)

Supported Faktory versions

  • 0.9.7
  • 1.0.1

It could work on earlier versions, but untested.

Installation / Usage

Formal instructions are coming soon. In the meantime, use Composer to install the package:

composer require jcs224/faktory_worker_php5

Pushing jobs

use FaktoryQueue\FaktoryClient;
use FaktoryQueue\FaktoryJob;

// $client = new FaktoryClient('localhost', '7419', 'insecure_password'); // Example with password
$client = new FaktoryClient('localhost', '7419');
$job1 = new FaktoryJob('cooljob', [
    1,
    2
]);

$job2 = new FaktoryJob('cooljob2', [
    3,
    4
]);

$client->push($job1);
$client->push($job2);

Starting a worker that listens for jobs

use FaktoryQueue\FaktoryClient;
use FaktoryQueue\FaktoryWorker;

// $client = new FaktoryClient('localhost', '7419', 'insecure_password'); // Example with password
$client = new FaktoryClient('localhost', '7419');
$worker = new FaktoryWorker($client);

$worker->register('cooljob', function($job) {
    echo "something cool: ".$job['args'][0].' '.$job['args'][1]."\n";
});

$worker->register('cooljob2', function($job) {
    echo "This is cooler: ".$job['args'][0].' '.$job['args'][1]."\n";
});

$worker->run(true);

About

Faktory job queue library for PHP. Compatible with PHP 5.6

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%