PHPackages                             daanbiesterbos/job-queue-bundle - 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. daanbiesterbos/job-queue-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

daanbiesterbos/job-queue-bundle
===============================

Allows to run and schedule Symfony console commands as background jobs.

2.2.0(5y ago)319.7kApache-2.0PHPPHP &gt;=7.3

Since Sep 3Pushed 5y agoCompare

[ Source](https://github.com/DaanBiesterbos/JMSJobQueueBundle)[ Packagist](https://packagist.org/packages/daanbiesterbos/job-queue-bundle)[ Docs](https://github.com/daanbiesterbos/JMSJobQueueBundle)[ RSS](/packages/daanbiesterbos-job-queue-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (15)Versions (15)Used By (0)

JMSJobQueueBundle
=================

[](#jmsjobqueuebundle)

[![Build](https://github.com/DaanBiesterbos/JMSJobQueueBundle/actions/workflows/build.yaml/badge.svg)](https://github.com/DaanBiesterbos/JMSJobQueueBundle/actions/workflows/build.yaml)[![Latest Stable Version](https://camo.githubusercontent.com/472d6a14b139d98f8c8b3cf85f7b9a3a97a9e10190aab14ba169210dae9fe220/68747470733a2f2f706f7365722e707567782e6f72672f6461616e62696573746572626f732f6a6f622d71756575652d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/daanbiesterbos/job-queue-bundle)[![Total Downloads](https://camo.githubusercontent.com/32b86e3706c12fc94a4bfb6b43abbaf1319da03a2715a407d3ae735b8ca4f4f6/68747470733a2f2f706f7365722e707567782e6f72672f6461616e62696573746572626f732f6a6f622d71756575652d62756e646c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/daanbiesterbos/job-queue-bundle)

Installation
============

[](#installation)

```
composer require daanbiesterbos/job-queue-bundle
```

Register Bundle
---------------

[](#register-bundle)

Add the bundle to bundles.php:

```
JMS\JobQueueBundle\JMSJobQueueBundle::class => ['all' => true],
```

Prepare Console Executable
--------------------------

[](#prepare-console-executable)

Copy `bin/console` to `bin/job-queue` and use the JMSJobQueueBundle application instead the standard Symfony application.

```
#
# Copy the console executable
#

cp bin/console bin/job-queue

#
# Open bin/job-queue in a text editor
#
# Look for this line:
# use Symfony\Bundle\FrameworkBundle\Console\Application;
#
# And change it to:
# use JMS\JobQueueBundle\Console\Application;

vim bin/job-queue
```

Note that this is part of the original bundle. I would prefer a better solution that does not require an extra console. However, for now backward compatibility is more important considering the purpose of the fork.

Usage
=====

[](#usage)

Creating Jobs
-------------

[](#creating-jobs)

Creating jobs is simple, you just need to persist an instance of `Job`:

```
    $em->persist($job);
    $em->flush($job);
```

Adding Dependencies Between Jobs
--------------------------------

[](#adding-dependencies-between-jobs)

If you want to have a job run after another job finishes, you can also achieve this quite easily:

```
    $job->addDependency($job);
    $em->persist($job);
    $em->persist($dependentJob);
    $em->flush();
```

Schedule Job
------------

[](#schedule-job)

If you want to schedule a job :

```
    $job->add(new DateInterval('PT30M'));
    $job->setExecuteAfter($date);
    $em->persist($job);
    $em->flush();
```

Fine-grained Concurrency Control through Queues
-----------------------------------------------

[](#fine-grained-concurrency-control-through-queues)

If you would like to better control the concurrency of a specific job type, you can use queues: Queues allow you to enforce stricter limits as to how many jobs are running per queue. By default, the number of jobs per queue is not limited as such queues will have no effect (jobs would just be processed in the order that they were created in). To define a limit for a queue, you can use the bundle?s configuration:

```
    jms_job_queue:
        queue_options_defaults:
            max_concurrent_jobs: 3 # This limit applies to all queues (including the default queue).
                                   # So each queue may only process 3 jobs simultaneously.
        queue_options:
            foo:
                max_concurrent_jobs: 2 # This limit applies only to the "foo" queue.
```

\_\_ \*\*Note: \*\*Queue settings apply for each instance of the `jms-job-queue:run` command separately. There is no way to specify a global limit for all instances.

Prioritizing Jobs
-----------------

[](#prioritizing-jobs)

By default, all jobs are executed in the order in which they are scheduled (assuming they are in the same queue). If you would like to prioritize certain jobs in the same queue, you can set a priority:

```
$job = new Job('a', array(), true, Job::DEFAULT_QUEUE, Job::PRIORITY_HIGH);
$em->persist($job);
$em->flush();
```

The priority is a simple integer - the higher the number, the sooner a job is executed.

Scheduled Jobs - JMSJobQueueBundle Documentation
================================================

[](#scheduled-jobs---jmsjobqueuebundle-documentation)

This bundle also allows you to have scheduled jobs which are executed in certain intervals. This can either be achieved by implementing `JMSJobQueueBundleCommandCronCommand` in your command, or implementing `JMSJobQueueBundleCronJobScheduler` in a service and tagging the service with `jms_job_queue.scheduler`. The jobs are then scheduled with the `jms-job-queue:schedule` command that is run as an additional background process. You can also run multiple instances of this command to ensure high availability and avoid a single point of failure.

Implement CronCommand
---------------------

[](#implement-croncommand)

```
    class MyScheduledCommand extends Command implements CronCommand
    {
        // configure, execute, etc. ...

        public function shouldBeScheduled(DateTime $lastRunAt)
        {
            return time() - $lastRunAt->getTimestamp() >= 60; // Executed at most every minute.
        }

        public function createCronJob(DateTime $lastRunAt)
        {
            return new Job('my-scheduled-command');
        }
    }
```

For common intervals, you can also use one of the provided traits:

```
    class MyScheduledCommand extends ContainerAwareCommand implements CronCommand
    {
        use ScheduleEveryMinute;

        // ...
    }
```

Implement JobScheduler
----------------------

[](#implement-jobscheduler)

This is useful if you want to run a third-party command or a Symfony command as a scheduled command via this bundle.

```
    class MyJobScheduler implements JobScheduler
    {
        public function getCommands(): array
        {
            return ['my-command'];
        }

        public function shouldSchedule($commandName, DateTime $lastRunAt)
        {
            return time() - $lastRunAt->getTimestamp() >= 60; // Executed at most every minute.
        }

        public function createJob($commandName, DateTime $lastRunAt)
        {
            return new Job('my-command');
        }
    }
```

Links
-----

[](#links)

- Documentation: [Github Repository](https://github.com/DaanBiesterbos/JMSJobQueueBundle)
- License: [LICENSE](https://raw.githubusercontent.com/DaanBiesterbos/JMSJobQueueBundle/master/LICENSE)
- Forked from: [JMSJobQueueBundle](https://github.com/schmittjoh/JMSJobQueueBundle)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 64.4% 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 ~278 days

Recently: every ~348 days

Total

11

Last Release

1891d ago

Major Versions

1.4.2 → 2.0.02018-11-01

PHP version history (4 changes)1.3.0PHP ^5.5.0

1.4.0PHP ^5.5.0 || ^7.0

2.0.0PHP ^7.1

2.2.0PHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3858692?v=4)[Daan Biesterbos](/maintainers/DaanBiesterbos)[@DaanBiesterbos](https://github.com/DaanBiesterbos)

---

Top Contributors

[![schmittjoh](https://avatars.githubusercontent.com/u/197017?v=4)](https://github.com/schmittjoh "schmittjoh (172 commits)")[![rcousens](https://avatars.githubusercontent.com/u/6834920?v=4)](https://github.com/rcousens "rcousens (28 commits)")[![samuel4x4](https://avatars.githubusercontent.com/u/3427855?v=4)](https://github.com/samuel4x4 "samuel4x4 (14 commits)")[![bassrock](https://avatars.githubusercontent.com/u/1010384?v=4)](https://github.com/bassrock "bassrock (8 commits)")[![tunght13488](https://avatars.githubusercontent.com/u/828808?v=4)](https://github.com/tunght13488 "tunght13488 (5 commits)")[![nclavaud](https://avatars.githubusercontent.com/u/1181770?v=4)](https://github.com/nclavaud "nclavaud (4 commits)")[![DaanBiesterbos](https://avatars.githubusercontent.com/u/3858692?v=4)](https://github.com/DaanBiesterbos "DaanBiesterbos (3 commits)")[![ecentinela](https://avatars.githubusercontent.com/u/13818?v=4)](https://github.com/ecentinela "ecentinela (3 commits)")[![nicolas-brousse](https://avatars.githubusercontent.com/u/699216?v=4)](https://github.com/nicolas-brousse "nicolas-brousse (3 commits)")[![NicolasBadey](https://avatars.githubusercontent.com/u/639268?v=4)](https://github.com/NicolasBadey "NicolasBadey (3 commits)")[![linglongscru](https://avatars.githubusercontent.com/u/19403917?v=4)](https://github.com/linglongscru "linglongscru (2 commits)")[![maeyan-zero](https://avatars.githubusercontent.com/u/1272725?v=4)](https://github.com/maeyan-zero "maeyan-zero (2 commits)")[![pierredup](https://avatars.githubusercontent.com/u/144858?v=4)](https://github.com/pierredup "pierredup (2 commits)")[![cklm](https://avatars.githubusercontent.com/u/466021?v=4)](https://github.com/cklm "cklm (2 commits)")[![temp](https://avatars.githubusercontent.com/u/216128?v=4)](https://github.com/temp "temp (1 commits)")[![tobiassjosten](https://avatars.githubusercontent.com/u/65159?v=4)](https://github.com/tobiassjosten "tobiassjosten (1 commits)")[![maxwellmc](https://avatars.githubusercontent.com/u/25797126?v=4)](https://github.com/maxwellmc "maxwellmc (1 commits)")[![ftassi](https://avatars.githubusercontent.com/u/176622?v=4)](https://github.com/ftassi "ftassi (1 commits)")[![hslatman](https://avatars.githubusercontent.com/u/1219780?v=4)](https://github.com/hslatman "hslatman (1 commits)")[![jspizziri](https://avatars.githubusercontent.com/u/1452066?v=4)](https://github.com/jspizziri "jspizziri (1 commits)")

---

Tags

queuejobcronbackgroundscheduled

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/daanbiesterbos-job-queue-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/daanbiesterbos-job-queue-bundle/health.svg)](https://phpackages.com/packages/daanbiesterbos-job-queue-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M373](/packages/easycorp-easyadmin-bundle)[kimai/kimai

Kimai - Time Tracking

4.7k8.7k1](/packages/kimai-kimai)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1155.2k](/packages/rcsofttech-audit-trail-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)

PHPackages © 2026

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