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

ActiveYii2-extension[Queues &amp; Workers](/categories/queues)

djeux/yii2-queue
================

62351PHP

Since Oct 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/djeux/yii2-queue)[ Packagist](https://packagist.org/packages/djeux/yii2-queue)[ RSS](/packages/djeux-yii2-queue/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

\##General Queue component for yii2

Currently only supports beanstalkd driver but can easily be extended to support other types

\##Installation

```
composer require djeux/yii2-queue
```

\##Configuration In your config/main.php (because you need to setup the queue to work in both console and web)

```
'components' => [
    'queue' => [
        'class' => 'djeux\queue\BeanstalkdQueueManager', // in this example we use beanstalkd driver
        'host' => '127.0.0.1',
        'worker' => [
            'listen' => ['default', /* here you define what tubes should the worker listen to */]
        ],
    ],
]
```

\##Usage In your code you can push jobs two ways

1. By passing an object which implements 'Queueable' interface

```
Yii::$app->queue->push(new MyJob("text to push"), '', 'default');

class MyJob implements Queueable
{
    protected $pushedText;

    public function __construct($text)
    {
        $this->pushedText = $text;
    }

    /**
     * @param $job BaseJob
     */
    public function handle($job)
    {
        echo $this->pushedText;
        $job->delete();
    }
}
```

2. By passing a string with class and method separated by '@'

```
Yii::$app->queue->push('app\components\queue\MyJob@myMethod', 'text to push', 'default');

class MyJob
{
    public function myMethod($job, $data)
    {
        echo $data;
        $job->delete();
    }
}
```

### Workers

[](#workers)

You can setup workers to run from supervisord

There are two main methods

```
php yii queue/manager
```

Runs a manager which checks the configured worker and launched a process for each listed queue

```
php yii queue/worker
```

Which runs a daemon that processes queue jobs

Troubleshooting
---------------

[](#troubleshooting)

If you have jobs that use database connection, and they're running in daemon mode, the server will eventually disconnect you. @see wait\_timeout

To counter that there's a trait in \\djeux\\queue\\helpers\\TimeoutTrait which you can call to keep the jobs processing and reconnect if the connection is dropped

Same goes for swiftmailer if you sending emails. The smtp will eventually disconnect you with

```
421 Timeout waiting for data from client.
```

To counter that you can use

```
try {
    \Yii::$app->mailer->send($message);
} catch (\Exception $e) {
    if (strpos(strtolower($e->getMessage()), '421 timeout') !== false) {
        if (($mailer = \Yii::$app->mailer) instanceof Mailer) {
            /* @var $mailer Mailer */
            $mailer->getSwiftMailer()->getTransport()->stop();
            $this->send($job, $data);
        }
    }
}
```

You can add methods like "beforeJob" and "afterJob" which will be called before and after a job is processed.

\#P.S. Package inspiration taken from Laravel implementation of queue system.

For any suggestions, fixes and hate posts, please write issues.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2291051?v=4)[Andrei Lukkonen](/maintainers/djeux)[@djeux](https://github.com/djeux)

---

Top Contributors

[![djeux](https://avatars.githubusercontent.com/u/2291051?v=4)](https://github.com/djeux "djeux (21 commits)")

### Embed Badge

![Health badge](/badges/djeux-yii2-queue/health.svg)

```
[![Health](https://phpackages.com/badges/djeux-yii2-queue/health.svg)](https://phpackages.com/packages/djeux-yii2-queue)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.5M30](/packages/league-geotools)[illuminate/bus

The Illuminate Bus package.

6045.5M513](/packages/illuminate-bus)[uecode/qpush-bundle

Asynchronous processing for Symfony using Push Queues

1672.5M2](/packages/uecode-qpush-bundle)[mayconbordin/l5-stomp-queue

Stomp Queue Driver for Laravel 5

121.1k](/packages/mayconbordin-l5-stomp-queue)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
