PHPackages                             mle86/wq - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. mle86/wq

ActiveLibrary[Queues &amp; Workers](/categories/queues)

mle86/wq
========

A simple library for work-queue and job handling.

v0.21.2(9mo ago)21.8k3MITPHPPHP &gt;=8.0CI failing

Since Apr 17Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/mle86/php-wq)[ Packagist](https://packagist.org/packages/mle86/wq)[ RSS](/packages/mle86-wq/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (38)Used By (3)

WQ (`mle86/wq`)
===============

[](#wq--mle86wq)

[![Build Status](https://camo.githubusercontent.com/379d9cea7e4b8e7b4ec9b17ec00d24b82ec8f47c91af3c2118ebf7af993a9d88/68747470733a2f2f7472617669732d63692e6f72672f6d6c6538362f7068702d77712e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mle86/php-wq)[![Coverage Status](https://camo.githubusercontent.com/dd91ef7140c7ef9480b734f8bd5b77e239631b4889f19e76aebd388a57183d20/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6c6538362f7068702d77712f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mle86/php-wq?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/9ba388a134043ab8c5908d5a432400585bc52789c76d0efc932e436ebb345cfe/68747470733a2f2f706f7365722e707567782e6f72672f6d6c6538362f77712f76657273696f6e)](https://packagist.org/packages/mle86/wq)[![PHP 8](https://camo.githubusercontent.com/b768ea3817a56fa9bbfbf241ce7d030e35cd87ff5b9b7f9ef8fb221f49397d04/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382d3838393242462e7376673f7374796c653d666c6174)](https://php.net/)[![License](https://camo.githubusercontent.com/2fd24b5bd3fd36b2076157aaccd5e3de4e0940622f446a41f71485f768e9644d/68747470733a2f2f706f7365722e707567782e6f72672f6d6c6538362f77712f6c6963656e7365)](https://packagist.org/packages/mle86/wq)

This package provides an easy way to put PHP tasks of any kind into a work queue such as Beanstalkd or Redis to execute them at a later time.

This is **version 0.21.1**.

Installation and Dependencies
=============================

[](#installation-and-dependencies)

```
$ composer require mle86/wq

```

It requires PHP 8.0+ and has no other dependencies (apart from PHPUnit/Coveralls for development and the PSR-3 interfaces).

Adapter Implementations
-----------------------

[](#adapter-implementations)

You'll also want to install at least one other package which contains a `WorkServerAdapter` implementation, such as:

- [mle86/wq-beanstalkd](https://github.com/mle86/php-wq-beanstalkd)(Beanstalkd server adapter),
- [mle86/wq-redis](https://github.com/mle86/php-wq-redis)(Redis server adapter),
- [mle86/wq-amqp](https://github.com/mle86/php-wq-amqp)(RabbitMQ server adapter).

Basic Concepts
==============

[](#basic-concepts)

- A *Job* is something which should be done exactly once. Maybe it's sending an e-mail, maybe it's an external API call like a webhook, maybe it's some slow clean-up process. In any case, we're talking about a unit of work that could be executed right away but it would be better for the application's performance to put it in a *Work Queue* instead, so it can be done asynchronously.
- A *Work Queue* is a list of jobs that should be executed at some other time. They are stored in some kind of *Work Server*. One work server well-known in the PHP world is [Beanstalkd](http://kr.github.io/beanstalkd/). It can store any number of work queues, although it calls them “tubes”.

Different work queues, or tubes, are commonly used to separate job types. For example, the same work server might have one “`mail`” queue for outgoing mails to be sent, one “`cleanup`” queue for all kinds of clean-up jobs, and one “`webhook`” queue for outgoing web-hook calls.

This package provides some helpful classes to set up a simple work queue system.

Quick Start
===========

[](#quick-start)

This is our Job implementation. It represents an e-mail that can be sent.

```
