2017 © Pedro Peláez
 

library celery-php

PHP client for Celery task queue

image

massivescale/celery-php

PHP client for Celery task queue

  • Friday, July 20, 2018
  • by massivescale
  • Repository
  • 34 Watchers
  • 331 Stars
  • 100,602 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 97 Forks
  • 10 Open issues
  • 12 Versions
  • 7 % Grown

The README.md

Archived

I have no more commercial or personal use for this project. It doesn't seem to be used by any Free Software projects and I'm definitely not spending my spare time on something used internally by some random companies I never met. Check out the forks, maybe you'll find something that works for you there., (*1)

Thanks to all the contributors!, (*2)

PHP client capable of executing Celery tasks and reading asynchronous results., (*3)

Uses AMQP extension from PECL, the PHP AMQP implementation or Redis and the following settings in Celery:, (*4)

result_serializer = 'json'
result_expires = None
task_track_started = False

The required PECL-AMQP version is at least 1.0. Last version tested is 1.4., (*5)

Last PHP-amqplib version tested is 2.5.1., (*6)

Last predis version tested is 1.0.1., (*7)

Requires Celery 4.0+., (*8)

API documentation is dead, help wanted, (*9)

POSTING TASKS

$c = new \Celery\Celery('localhost', 'myuser', 'mypass', 'myvhost');
$result = $c->PostTask('tasks.add', array(2,2));

// The results are serializable so you can do the following:
$_SESSION['celery_result'] = $result;
// and use this variable in an AJAX call or whatever

tip: if using RabbitMQ guest user, set "/" vhost, (*10)

READING ASYNC RESULTS

while (!$result->isReady())    {
    sleep(1);
    echo '...';
}

if ($result->isSuccess()) {
    echo $result->getResult();
} else {
    echo "ERROR";
    echo $result->getTraceback();
}

GET ASYNC RESULT MESSAGE

$c = new \Celery\Celery('localhost', 'myuser', 'mypass', 'myvhost');
$message = $c->getAsyncResultMessage('tasks.add', 'taskId');

PYTHON-LIKE API

An API compatible to AsyncResult in Python is available too., (*11)

$c = new \Celery\Celery('localhost', 'myuser', 'mypass', 'myvhost');
$result = $c->PostTask('tasks.add', array(2,2));

$result->get();
if ($result->successful()) {
    echo $result->result;
}

ABOUT

Based on this blog post and reading Celery sources. Thanks to Skrat, author of Celerb for a tip about response encoding. Created for the needs of my consulting work at Massive Scale., (*12)

License is 2-clause BSD., (*13)

DEVELOPMENT

Development process and goals., (*14)

CONNECTING VIA SSL

Connecting to a RabbitMQ server that requires SSL is currently only possible via PHP-amqplib to do so you'll need to create a celery object with ssl options:, (*15)

$ssl_options = [
    'cafile' => 'PATH_TO_CA_CERT_FILE',
    'verify_peer' => true,
    'passphrase' => 'LOCAL_CERT_PASSPHRASE',
    'local_cert' => 'PATH_TO_COMBINED_CLIENT_CERT_KEY',
    'CN_match' => 'CERT_COMMON_NAME'
];

$c = new \Celery\Celery($host, $user, $password, $vhost, 'celery', 'celery', 5671, false, 0, $ssl_options);

CONNECTING TO REDIS

Refer to files in testscenario/ for examples of celeryconfig.py., (*16)

$c = new \Celery\Celery(
    'localhost', /* Server */
    '', /* Login */
    'test', /* Password */
    'wutka', /* vhost */
    'celery', /* exchange */
    'celery', /* binding */
    6379, /* port */
    'redis' /* connector */
);

The Versions

20/07 2018

dev-revert-117-persis

dev-revert-117-persis https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.4.0

 

The Development Requires

task redis queue cron amqp python celery

20/07 2018

dev-master

9999999-dev https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.4.0

 

The Development Requires

task redis queue cron amqp python celery

27/12 2017

dev-celery4

dev-celery4 https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

task redis queue cron amqp python celery

07/11 2016

dev-celery4_pr66

dev-celery4_pr66 https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

task redis queue cron amqp python celery

16/10 2016

2.1.2

2.1.2.0 https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

task redis queue cron amqp python celery

20/11 2015

dev-drewpctest

dev-drewpctest https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

task redis queue cron amqp python celery

21/07 2015

2.1.1

2.1.1.0 https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

 

task redis queue cron amqp python celery

17/12 2014

dev-pull-39-test

dev-pull-39-test https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

 

task queue cron amqp python celery

31/07 2014

dev-php-amqplib

dev-php-amqplib https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

 

task queue cron amqp python celery

23/04 2014

dev-redis

dev-redis https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

 

task queue cron amqp python celery

23/04 2014

dev-peclonly

dev-peclonly https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

  • ext-amqp >=1.0.0

 

task queue cron amqp python celery

23/04 2014

dev-celery31

dev-celery31 https://github.com/gjedeer/celery-php/

PHP client for Celery task queue

  Sources   Download

BSD-2-Clause

The Requires

 

task queue cron amqp python celery