, (*1)
Pull Task Queues for PHP on Google App Engine
This library provides native PHP access to the Google App Engine PULL Task Queue., (*2)
At the time of writing there is no off-the-shelf way to access this from the PHP runtime., (*3)
ALPHA This library is in the very early stages of development. Do not use it in production. It will change., (*4)
Table of Contents
Examples
I find examples a great way to decide if I want to even try out a library, so here's a couple for you., (*5)
queue.yaml
All the examples assume you have set up a pull queue called pullqueue
in your queue.yaml
file., (*6)
# My first pull queue
queue:
- name: pullqueue
mode: pull
Add One Task
// Create a task and give it a payload
$obj_task = new \AEQ\Pull\Task();
$obj_task->setPayload('Some data here');
// Add the task to a named queue
$obj_queue = new \AEQ\Pull\Queue('pullqueue');
$obj_queue->addTask($obj_task);
Lease then Delete a Task
// Create the queue
$obj_queue = new \AEQ\Pull\Queue('pullqueue');
// Lease 1 task
foreach($obj_queue->leaseTasks(1) as $obj_task) {
echo $obj_task->getPayload(); // Do any work we want to
$obj_queue->deleteTask($obj_task); // Delete the task once done
}
List Tasks
// Create the queue
$obj_queue = new \AEQ\Pull\Queue('pullqueue');
// List Tasks
foreach($obj_queue->listTasks() as $obj_task) {
echo $obj_task->getName();
}
Install with Composer
To install using Composer, use this require line in your composer.json
for bleeding-edge features, dev-master, (*7)
"tomwalder/php-appengine-pull-queue": "dev-master"
, (*8)
Or, if you're using the command line:, (*9)
composer require tomwalder/php-appengine-pull-queue
, (*10)
You will need minimum-stability: dev
, (*11)
References