PHPackages                             yiicod/yii2-jobqueue - 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. yiicod/yii2-jobqueue

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

yiicod/yii2-jobqueue
====================

Yii Job Queue based on Illuminate Queue

1.1.2.1(8y ago)107.3kMITPHP

Since Aug 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/yiicod/yii2-jobqueue)[ Packagist](https://packagist.org/packages/yiicod/yii2-jobqueue)[ RSS](/packages/yiicod-yii2-jobqueue/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (9)Versions (9)Used By (0)

Yii Job Queue based on Illuminate Queue
=======================================

[](#yii-job-queue-based-on-illuminate-queue)

[![Latest Stable Version](https://camo.githubusercontent.com/66a95c11f8b54c719ff18728248dba43c00c017655a7f652d22b6d986e1a120d/68747470733a2f2f706f7365722e707567782e6f72672f796969636f642f796969322d6a6f6271756575652f762f737461626c65)](https://packagist.org/packages/yiicod/yii2-jobqueue) [![Total Downloads](https://camo.githubusercontent.com/3f24e3464f8f1037feb5bbea58fde4bb537be56c18117a05792ff3579738239b/68747470733a2f2f706f7365722e707567782e6f72672f796969636f642f796969322d6a6f6271756575652f646f776e6c6f616473)](https://packagist.org/packages/yiicod/yii2-jobqueue) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/d532fd4536477eac5d1026a889d80d8f19e121e49834a4fa442262900fa3db33/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f796969636f642f796969322d6a6f6271756575652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yiicod/yii2-jobqueue/?branch=master)[![Code Climate](https://camo.githubusercontent.com/f3aa0f319d13b54c67d54089d219e8424f8230dc2d92ddf941b443e59cca9bec/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f796969636f642f796969322d6a6f6271756575652f6261646765732f6770612e737667)](https://codeclimate.com/github/yiicod/yii2-jobqueue)

Provides Illuminate queues implementation for Yii 2 using mongodb as main storage.

#### Base config:

[](#base-config)

```
    'bootstrap' => [
        'jobqueue'
    ],
    'components' => [
        'jobqueue' => [
            'class' => \yiicod\jobqueue\JobQueue::class
        ],
        'mongodb' => [
            'class' => '\yii\mongodb\Connection',
            'dsn' => 'mongodb://@localhost:27017/mydatabase',
        ],
    ]
```

#### Console config (simple fork)

[](#console-config-simple-fork)

```
    'bootstrap' => [
        'jobqueue'
    ],
    'controllerMap' => [
        'job-queue' => [
            'class' => \yiicod\jobqueue\commands\JobQueueCommand::class,
        ]
    ],
    'components' => [
        'jobqueue' => [
            'class' => \yiicod\jobqueue\JobQueue::class
        ],
        'mongodb' => [
            'class' => '\yii\mongodb\Connection',
            'dsn' => 'mongodb://@localhost:27017/mydatabase',
        ],
    ]
```

###### Start worker:

[](#start-worker)

Run worker daemon with console command:

```
$ php yii job-queue/start
```

Stop worker daemon:

```
$ php yii job-queue/stop
```

#### Console config + PM2(). This variant more preferable for console configuration.

[](#console-config--pm2httppm2keymetricsio-this-variant-more-preferable-for-console-configuration)

```
    'bootstrap' => [
        'jobqueue'
    ],
    'controllerMap' => [
        'job-queue' => [
            'class' => \yiicod\jobqueue\commands\WorkerCommand::class,
        ]
    ],
    'components' => [
        'jobqueue' => [
            'class' => \yiicod\jobqueue\JobQueue::class
        ],
        'mongodb' => [
            'class' => '\yii\mongodb\Connection',
            'dsn' => 'mongodb://@localhost:27017/mydatabase',
        ],
    ]
```

###### pm2 config:

[](#pm2-config)

```
    {
      "apps": [
        {
          "name": "job-queue",
          "script": "yii",
          "args": [
            "job-queue/work"
          ],
          "exec_interpreter": "php",
          "exec_mode": "fork_mode",
          "max_memory_restart": "1G",
          "watch": false,
          "merge_logs": true,
          "out_file": "runtime/logs/job_queue.log",
          "error_file": "runtime/logs/job_queue.log"
        }
      ]
    }
```

###### Run PM2 daemons

[](#run-pm2-daemons)

```
pm2 start daemons-app.json
```

Note: Don't forget configure mongodb

#### Adding jobs to queue:

[](#adding-jobs-to-queue)

Create your own handler which implements yiicod\\jobqueue\\base\\JobQueueInterface OR extends yiicod\\jobqueue\\handlers\\JobQueue and run parent::fire($job, $data) to restart db connection before job process

```
JobQueue::push(>, $data, $queue, $connection);
// Optional: $queue, $connection
```

Note: $data - additional data to your handler

#### Queue configuration:

[](#queue-configuration)

Add jobqueue component with connections parameters, specially with "MongoThreadQueue" driver and connection name ("default" in example)

```
'jobqueue' => [
    'class' => \yiicod\jobqueue\JobQueue::class,
    'connections' => [
        'default' => [
            'driver' => 'mongo-thread',
            'table' => 'yii-jobs',
            'queue' => 'default',
            'connection' => 'mongodb', // Default mongodb connection
            'expire' => 60,
            'limit' => 1, // How many parallel process should run at the same time
        ],
    ]
]
```

Worker will take jobs from mongo database and run them by thread with defined driver using "mongo-thread" command in the background

Available events:

---

In Worker::class:

```
EVENT_RAISE_BEFORE_JOB = 'raiseBeforeJobEvent';
EVENT_RAISE_AFTER_JOB = 'raiseAfterJobEvent';
EVENT_RAISE_EXCEPTION_OCCURED_JOB = 'raiseExceptionOccurredJobEvent';
EVENT_RAISE_FAILED_JOB = 'raiseFailedJobEvent';
EVENT_STOP = 'stop';
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 89.5% 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.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~17 days

Total

8

Last Release

2937d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7934283ca98b7f31bb5bf13119a8495cad80ac9097125a48792f47caddb588b9?d=identicon)[lexxorlov](/maintainers/lexxorlov)

---

Top Contributors

[![lexxorlov](https://avatars.githubusercontent.com/u/7910574?v=4)](https://github.com/lexxorlov "lexxorlov (17 commits)")[![dmitry-zf](https://avatars.githubusercontent.com/u/83698377?v=4)](https://github.com/dmitry-zf "dmitry-zf (1 commits)")[![Mark1Z](https://avatars.githubusercontent.com/u/9988709?v=4)](https://github.com/Mark1Z "Mark1Z (1 commits)")

---

Tags

multi-processqueueyii2-jobsyii2-queue

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/yiicod-yii2-jobqueue/health.svg)

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

###  Alternatives

[illuminate/queue

The Illuminate Queue package.

20331.4M1.2k](/packages/illuminate-queue)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[pierophp/laravel-queue-manager

Laravel Queue Manager

182.4k](/packages/pierophp-laravel-queue-manager)

PHPackages © 2026

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