PHPackages                             2tvenom/php-queue - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. 2tvenom/php-queue

ActiveLibrary

2tvenom/php-queue
=================

PHP Queue for task execution

91914[1 issues](https://github.com/2tvenom/php-queue/issues)PHP

Since Sep 9Pushed 10y ago4 watchersCompare

[ Source](https://github.com/2tvenom/php-queue)[ Packagist](https://packagist.org/packages/2tvenom/php-queue)[ RSS](/packages/2tvenom-php-queue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#PhpQueue
----------

[](#phpqueue)

The PhpQueue library provides queue for execution php scripts. This code has been developed and maintained by Ven from August 2013 to October 2013.

You can send comments, patches, questions here on github or to

---

1. [Queue](#queue)
    - [Simple queue](#simple-queue)
    - [Adding task to queue](#adding-task-to-queue)
    - [Get task from queue and execute](#get-task-from-queue-and-execute)
2. [Task](#task)
    - [Create task](#create-task)
    - [Request data](#request-data)
    - [Select task from queue](#select-task-from-queue)
    - [Priority](#priority)
    - [Task group id](#task-group-id)
    - [Execution date](#execution-date)
    - [Unique id](#unique-id)
3. [Task and sub tasks](#task-and-sub-tasks)
    - [Sub tasks](#sub-tasks)
    - [Exclusive tasks](#exclusive-tasks)
        - [Non exclusive](#non-exclusive)
        - [Exclusive](#exclusive)
    - [Task response, log, parent](#task-response-log-parent)
    - [Response](#response)
    - [Log](#log)
    - [Access to parent task](#access-to-parent-task)
4. [Error in task and sub tasks](#error-in-task-and-sub-tasks)
    - [Error in simple task](#error-in-simple-task)
    - [Error in task with sub tasks](#error-in-task-with-sub-tasks)
    - [Nested settings](#nested-settings)
    - [Error log](#error-log)
5. [Callbacks and error callback](#callbacks-and-error-callback)
    - [Callback](#callback)
    - [Error callback](#error-callback)
    - [Callbacks of Parent task](#callbacks-of-parent-task)
    - [Global callback](#global-callback)
    - [Errors in callback](#errors-in-callback)
    - [Callback execution priority](#callback-execution-priority)
6. [Queue drivers](#queue-drivers)
    - [SqlPdoDriver](#sqlpdodriver)
    - [FileDriver](#filedriver)
7. [Autoloader](#autoloader)
8. [Web interface](#web-interface)
    - [Installation](#installation)
    - [Driver connection](#driver-connection)
    - [Driver connection property](#driver-connection-property)
    - [Customisation](#customisation)

---

\##Queue ###Simple queue
------------------------

[](#queuesimple-queue)

\###Adding task to queue

PhpQueue have components: Queue, QueueDriver, TaskPerformer and Task.

\#####*Example*

```

```

---

\###Get task from queue and execute Steps of getting task from the queue and execute. Queue return `false` If queue not have task.

1. Connect to queue
2. Get task from queue
3. **Queue set task status In Process**
4. Execute task
5. Modify task status in queue (**Warning!** This step is required)

\#####*Example*

```

```

---

Task
----

[](#task)

### Create task

[](#create-task)

Task name this is name of class implemented in `PhpQueue\Interfaces\IJob`

\#####*Example*

```

```

---

### Request data

[](#request-data)

Task can receive input data. This is one object, array or scalar value.

\#####*Example*

```

```

You can set data in constructor `$task = new PhpQueue\Task("Job", 100);` or by method `$task->set_request_data(100);`

---

\###Select task from queue

---

\###Priority Tasks in queue sorted by priority. All tasks by default have zero priority. If the tasks have the same priority, then to order by id desc.

Set priority: `set_priority($priority)`. Priority must be integer.

Get priority: `get_priority()`

\####*Example*

```
