PHPackages                             elmys/yii2-queue-redis - 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. [Caching](/categories/caching)
4. /
5. elmys/yii2-queue-redis

ActiveYii2-extension[Caching](/categories/caching)

elmys/yii2-queue-redis
======================

Quick deployment of an interface for easy work with queues based on Redis for Yii2.

v1.0.7(1y ago)020GPL-3.0-onlyPHPPHP &gt;=8.1

Since May 13Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (8)Used By (0)

yii2-queue-redis
================

[](#yii2-queue-redis)

Quick deployment of an interface for easy work with queues based on Redis for Yii2

[![chrome_C0woYqkBVf](https://private-user-images.githubusercontent.com/5611459/443262147-054c3afa-6702-4a5a-be66-431fa7e65d63.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxMDY2NDMsIm5iZiI6MTc3NTEwNjM0MywicGF0aCI6Ii81NjExNDU5LzQ0MzI2MjE0Ny0wNTRjM2FmYS02NzAyLTRhNWEtYmU2Ni00MzFmYTdlNjVkNjMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDJUMDUwNTQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGVlMDkxNmVkMjUyNDE0NWQwMGM0MDMxZmRmMjI0MDUzZWViZjEzZGQ5MGZhNDVkYzlhOGU2OTM1NzdjZjIzYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.VCafGOVp5GC9ZZyNqfQNBx819NH-LKlco5Qel4hBxMw)](https://private-user-images.githubusercontent.com/5611459/443262147-054c3afa-6702-4a5a-be66-431fa7e65d63.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxMDY2NDMsIm5iZiI6MTc3NTEwNjM0MywicGF0aCI6Ii81NjExNDU5LzQ0MzI2MjE0Ny0wNTRjM2FmYS02NzAyLTRhNWEtYmU2Ni00MzFmYTdlNjVkNjMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDJUMDUwNTQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGVlMDkxNmVkMjUyNDE0NWQwMGM0MDMxZmRmMjI0MDUzZWViZjEzZGQ5MGZhNDVkYzlhOGU2OTM1NzdjZjIzYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.VCafGOVp5GC9ZZyNqfQNBx819NH-LKlco5Qel4hBxMw)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

- Either run

```
php composer.phar require --prefer-dist "elmys/yii2-queue-redis" : "~1.0"

```

or add

```
"elmys/yii2-queue-redis" : "~1.0"

```

to the require section of your application's `composer.json` file.

Usage
-----

[](#usage)

1. Add to your index-file new import `require __DIR__ . '/../config/definitions.php';` with bellow content:

```
const QUEUE_ACCOUNT = 'queueAccount'; // Here will be real names of your queue on redis created
const QUEUE_BILLING = 'queueBilling';
const QUEUE_OTHER = 'queueOther';

const LAYER_DEV = '0';
const LAYER_STAGE = '1';
const LAYER_PROD = '9';

const LAYERS = [
    LAYER_DEV => 'dev',
    LAYER_STAGE => 'stage',
    LAYER_PROD => 'prod',
];

const ONE_QUEUES = [
    QUEUE_ACCOUNT,
    QUEUE_BILLING,
];
const TWO_QUEUES = [
    QUEUE_OTHER,
];
const ALL_QUEUES = [
    'one-micro-service' => ONE_QUEUES, // these array keys for CSS-styling only
    'two-micro-service' =>  TWO_QUEUES,
];
```

Define layers for yii-environment. It can be used for switch DB on redis, just adding `?layer=0` to url. You can write any digits from 0 to 9; Separated constants with queue names need for stylizing with css and visual usefully.

2. Add bellow files and import it to main config on import block `web.php`:

```
$redis = require __DIR__ . '/redis.php';
$queuesBootstrap = require __DIR__ . '/queues-bootstrap.php';
$queues = require __DIR__ . '/queues-local.php';
```

- redis.php

```
