PHPackages                             ostark/craft-async-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. ostark/craft-async-queue

ActiveCraft-plugin[Queues &amp; Workers](/categories/queues)

ostark/craft-async-queue
========================

A queue handler that moves queue execution to a non-blocking background process

4.0.0(2y ago)95288.6k↓29.2%7[2 issues](https://github.com/ostark/craft-async-queue/issues)[3 PRs](https://github.com/ostark/craft-async-queue/pulls)9MITPHPPHP ^8.0

Since Aug 24Pushed 1y ago2 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (34)Used By (9)

Async (Background) Queue
========================

[](#async-background-queue)

[![Latest Stable Version](https://camo.githubusercontent.com/5e3890c0bead0df3adbe6a8618a38fd2a718fcfffb7eed22271672f4acdf56d5/68747470733a2f2f706f7365722e707567782e6f72672f6f737461726b2f63726166742d6173796e632d71756575652f762f737461626c65)](https://packagist.org/packages/ostark/craft-async-queue)[![Total Downloads](https://camo.githubusercontent.com/6f6bdcf6e96cc5a58697a7e722c688c6fc5e272b0659ed2b1bab2e0cd82ac5a3/68747470733a2f2f706f7365722e707567782e6f72672f6f737461726b2f63726166742d6173796e632d71756575652f646f776e6c6f616473)](https://packagist.org/packages/ostark/craft-async-queue)[![Monthly Downloads](https://camo.githubusercontent.com/124d7674645a0320f3f25fd50471537781bb8bfef23d783fefc63d574dd48d03/68747470733a2f2f706f7365722e707567782e6f72672f6f737461726b2f63726166742d6173796e632d71756575652f642f6d6f6e74686c79)](https://packagist.org/packages/ostark/craft-async-queue)[![Buy us a tree](https://camo.githubusercontent.com/130148911f548b001b2ac68a32c0a06559977ca60ada3bf480c72ae4ea093175/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e)](https://plant.treeware.earth/ostark/craft-async-queue)

With Craft's job queue you can run heavy tasks in the background. Unfortunately, this is not entirely true. When `runQueueAutomatically => true` (default), the job queue is handled by a ajax (FPM) call. With many jobs in the queue and limited PHP-FPM processes this can break your site. This plugin replaces Craft's default queue handler and moves queue execution to a non-blocking background process. The command `craft queue/run` gets executed right after you push a job to the queue.

[Here](https://github.com/craftcms/cms/issues/1952) you can find the initial discussion I started at `craftcms/cms`.

Sponsor 🐇
---------

[](#sponsor-)

Development happens in my free time, but also during working hours. Thanks [fortrabbit.com](https://www.fortrabbit.com/craft-hosting)!

Licence 🌳
---------

[](#licence-)

This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/ostark/craft-async-queue) to thank me for my work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Requirements
------------

[](#requirements)

- Craft 3 or 4
- Permissions to execute a php binary
- proc\_open()
- **PHP &gt;=7.1** (for PHP 7.0 use `ostark/craft-async-queue:1.3.*`)

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

[](#installation)

```
cd your/craft-project
composer require ostark/craft-async-queue
php craft install/plugin async-queue
```

If you run into Composer version conflicts:

```
composer config platform --unset
composer update
php craft migrate/all
composer require ostark/craft-async-queue
php craft install/plugin async-queue

```

Configuration (optional)
------------------------

[](#configuration-optional)

The plugin uses [symfony/process](https://github.com/symfony/process) to execute the `php` binary. Usually the binary is located in `/usr/bin/`, but other common locations are auto detected as well. With the ENV var `PHP_BINARY` you can explicitly set the path, e.g. in your .env file like this:

```
PHP_BINARY="/usr/local/Cellar/php71/7.1.0_11/bin/php"

```

By default `1` background process handles the queue. With the `ASYNC_QUEUE_CONCURRENCY` ENV var you can modify this behaviour.

```
# No concurrency
ASYNC_QUEUE_CONCURRENCY=1

# Or max 5 background processes
ASYNC_QUEUE_CONCURRENCY=5

```

To disable the plugin in certain environments, like on Windows which is not supported yet, set the `DISABLE_ASYNC_QUEUE` ENV var.

```
DISABLE_ASYNC_QUEUE=1

```

Note that the plugin will overwrite the `runQueueAutomatically` setting with Craft CMS. No configurartion required.

Tests
-----

[](#tests)

Beside the test suite you can run from the command line with this shortcut: `composer tests`, you can perform a test in the Craft CP. Navigate to `Utilities` &gt; `Async Queue Test` and hit the `Run test` button.

Events
------

[](#events)

The command that runs in the background is basically `php craft queue/run`, however we add some linux specific syntax that executes the command in a non-blocking way. By setting `useDefaultDecoration` to `false` you prevent this. You have also the ability to modify the command itself.

```
// Add handler
\yii\base\Event::on(
     \ostark\AsyncQueue\QueueCommand::class,
     \ostark\AsyncQueue\QueueCommand::EVENT_PREPARE_COMMAND,
     function(\ostark\AsyncQueue\Events\QueueCommandEvent $event) {
         $event->useDefaultDecoration = false;
         $event->commandLine = "BEFORE {$event->commandLine} AFTER";
     }
);

```

Under the hood: Process list
----------------------------

[](#under-the-hood-process-list)

**Empty queue** (only php-fpm master is running)

```
$ ps auxf | grep php

root      2953  0.0  0.0 399552 13520 ?        Ss   12:27   0:00 php-fpm: master process (/etc/php/fpm.conf)

```

**New job pushed** (php-fpm master + child + /usr/bin/php daemon started)

```
$ ps auxf | grep php

root      2953  0.0  0.0 399552 13520 ?        Ss   12:27   0:00 php-fpm: master process (/etc/php/fpm.conf)
app       3031  2.2  0.2 718520 45992 ?        S    12:31   0:00  \_ php-fpm: pool www
app       3033  1.2  0.2 280936 32808 ?        S    12:31   0:00 /usr/bin/php craft queue/run
app       3034  0.0  0.0   4460   784 ?        S    12:31   0:00  \_ sh -c /usr/bin/php craft queue/exec "1234" "0" "1"
app       3035  1.2  0.2 280928 32280 ?        S    12:31   0:00      \_ /usr/bin/php craft queue/exec 1234 0 1

```

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~90 days

Recently: every ~143 days

Total

28

Last Release

760d ago

Major Versions

v1.x-dev → 2.0.02019-01-30

2.3.0 → 3.0.02022-05-19

3.2.0 → 4.0.02024-04-19

PHP version history (2 changes)2.2.0PHP &gt;=7.1

3.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f2939b15a562ee53b5284f58b704e53ae26b975c1154fa6afb2f8b8331fbd27?d=identicon)[ostark](/maintainers/ostark)

---

Top Contributors

[![ostark](https://avatars.githubusercontent.com/u/1941743?v=4)](https://github.com/ostark "ostark (4 commits)")[![jan-dh](https://avatars.githubusercontent.com/u/5801781?v=4)](https://github.com/jan-dh "jan-dh (2 commits)")[![phoob](https://avatars.githubusercontent.com/u/1475800?v=4)](https://github.com/phoob "phoob (2 commits)")[![frank-laemmer](https://avatars.githubusercontent.com/u/962736?v=4)](https://github.com/frank-laemmer "frank-laemmer (1 commits)")[![markhuot](https://avatars.githubusercontent.com/u/48975?v=4)](https://github.com/markhuot "markhuot (1 commits)")

---

Tags

craftcraft3craftcmscraftcms-pluginpluginqueuecmsCraftcraftcmscraft-plugin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ostark-craft-async-queue/health.svg)

```
[![Health](https://phpackages.com/badges/ostark-craft-async-queue/health.svg)](https://phpackages.com/packages/ostark-craft-async-queue)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[verbb/image-resizer

Resize assets when they are uploaded.

127269.1k7](/packages/verbb-image-resizer)[panlatent/schedule

Schedule plugin for CraftCMS

1034.1k](/packages/panlatent-schedule)[supercool/scheduler

Schedule jobs to be executed on a given date.

4215.7k](/packages/supercool-scheduler)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[verbb/hyper

A user-friendly links field for Craft.

24130.9k9](/packages/verbb-hyper)

PHPackages © 2026

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