PHPackages                             php-mqdb/php-mqdb - 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. php-mqdb/php-mqdb

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

php-mqdb/php-mqdb
=================

PHP Message Queue with database. Provide some interface, trait &amp; client to manage message queue in php.

4.1.2(2y ago)3196MITPHPPHP 8.1.\*||8.2.\*||8.3.\*CI passing

Since Aug 21Pushed 4d ago1 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (23)Used By (0)

php-mqdb
========

[](#php-mqdb)

[![Current version](https://camo.githubusercontent.com/746de85454dc9f8afc2eef80f84838b1ea71af72f789b9cfc12ec4032da64144/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d6d7164622f7068702d6d7164622e7376673f6c6f676f3d636f6d706f736572)](https://packagist.org/packages/php-mqdb/php-mqdb)[![Supported PHP version](https://camo.githubusercontent.com/1af61cae70d757d451edc34524bce5de51eb64f3cb6eeace9b286cf3b8a4e8df/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d706870266c6162656c3d504850266d6573736167653d382e312d382e3326636f6c6f723d373737626234)](https://packagist.org/packages/php-mqdb/php-mqdb)[![CI](https://github.com/php-mqdb/php-mqdb/workflows/CI/badge.svg)](https://github.com/php-mqdb/php-mqdb/workflows/CI/badge.svg)[![Quality Gate Status](https://camo.githubusercontent.com/106d438a8436bfde7039e4517dfde17519de6f064455df3311f02c3bfb522398/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068702d6d7164625f7068702d6d716462266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=php-mqdb_php-mqdb)[![Coverage](https://camo.githubusercontent.com/b64d3b464cb429c06395637d892b528546c73496375f45e186d9ae73138bd44c/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068702d6d7164625f7068702d6d716462266d65747269633d636f766572616765)](https://sonarcloud.io/dashboard?id=php-mqdb_php-mqdb)

PHP Message Queue. A full client / server to produce &amp; consume message from a queue.

Installation
------------

[](#installation)

### Composer

[](#composer)

```
$ composer require php-mqdb/php-mqdb
```

### Database

[](#database)

You must have a database with given table to store messages (the messages queue). A sample create table is provide in sql/ directory.

#### PDO &amp; Doctrine/DBAL

[](#pdo--doctrinedbal)

PDO &amp; DBAL repository are provided in this library. But only PDO is required by default. You can use Doctrine/DBAL library (v3 or v4), but you need to require it in your composer.json file.

Getting messages - How to work
------------------------------

[](#getting-messages---how-to-work)

### Default ordering

[](#default-ordering)

Functions getMessage() &amp; getMessages get messages in following order:

- priority ascendant
- date availability ascendant
- date create ascendant

So, the messages with high priority, and with prior date availability (and with prior creation date) will get in priority.

### Filtering

[](#filtering)

You may filter messages you want to get. Possible filters are:

- topic: specify which topic you want (default: null). You can use `*` character in topic filter (like: publish.\*)
- statuses: Get messages with given status(es) (default get pending messages)
- priorities: Get messages with only given priority(ies) (default: no filtering)
- entity id: Filter only on the given entity id (default: no filtering)

### Filtering on date

[](#filtering-on-date)

By default, the system only gets the available and non-expired messages. You can change filter value for available date &amp; expiration date. You also can change the current date.

### Limit result

[](#limit-result)

By default, getMessage() only gets one message. You may get multiple messages at the same time by using getMessages(), but you need to set how much messages you want (default is 1)

Usage
-----

[](#usage)

### Get a message

[](#get-a-message)

```
