PHPackages                             tobento/app-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. tobento/app-queue

ActiveLibrary[Queues &amp; Workers](/categories/queues)

tobento/app-queue
=================

Queue app support.

2.0.2(3mo ago)01058MITPHPPHP &gt;=8.4

Since Nov 29Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/tobento-ch/app-queue)[ Packagist](https://packagist.org/packages/tobento/app-queue)[ Docs](https://www.tobento.ch)[ RSS](/packages/tobento-app-queue/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (5)Dependencies (11)Versions (7)Used By (8)

App Queue
=========

[](#app-queue)

Queue support for the app using the [Queue Service](https://github.com/tobento-ch/service-queue).

Table of Contents
-----------------

[](#table-of-contents)

- [Getting Started](#getting-started)
    - [Requirements](#requirements)
- [Documentation](#documentation)
    - [App](#app)
    - [Queue Boot](#queue-boot)
        - [Queue Config](#queue-config)
        - [Creating Jobs](#creating-jobs)
        - [Dispatching Jobs](#dispatching-jobs)
        - [Running Queues](#running-queues)
        - [Failed Jobs](#failed-jobs)
- [Credits](#credits)

---

Getting Started
===============

[](#getting-started)

Add the latest version of the app queue project running this command.

```
composer require tobento/app-queue

```

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

[](#requirements)

- PHP 8.4 or greater

Documentation
=============

[](#documentation)

App
---

[](#app)

Check out the [**App Skeleton**](https://github.com/tobento-ch/app-skeleton) if you are using the skeleton.

You may also check out the [**App**](https://github.com/tobento-ch/app) to learn more about the app in general.

Queue Boot
----------

[](#queue-boot)

The queue boot does the following:

- installs and loads queue config file
- implements queue interfaces

```
use Tobento\App\AppFactory;
use Tobento\Service\Queue\QueueInterface;
use Tobento\Service\Queue\QueuesInterface;
use Tobento\Service\Queue\JobProcessorInterface;
use Tobento\Service\Queue\FailedJobHandlerInterface;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');

// Adding boots
$app->boot(\Tobento\App\Queue\Boot\Queue::class);
$app->booting();

// Implemented interfaces:
$queue = $app->get(QueueInterface::class);
$queues = $app->get(QueuesInterface::class);
$jobProcessor = $app->get(JobProcessorInterface::class);
$failedJobHandler = $app->get(FailedJobHandlerInterface::class);

// Run the app
$app->run();
```

**Console Note**

The queue boot automatically boots the [App Console Boot](https://github.com/tobento-ch/app-console#console-boot) as to run the queue worker using commands.

If you are not using the [App Skeleton](https://github.com/tobento-ch/app-skeleton) you may adjust the `app` file in the root directory with the path to your app:

```
// Get and run the application.
// (require __DIR__.'/app/app.php')->run();
(require __DIR__.'/path/to/app.php')->run();
```

### Queue Config

[](#queue-config)

The configuration for the queue is located in the `app/config/queue.php` file at the default [**App Skeleton**](https://github.com/tobento-ch/app-skeleton) config location where you can specify the queues for your application.

### Creating Jobs

[](#creating-jobs)

Check out the [Queue Service - Creating Jobs](https://github.com/tobento-ch/service-queue#creating-jobs) section to learn more about creating jobs.

### Dispatching Jobs

[](#dispatching-jobs)

Check out the [Queue Service - Dispatching Jobs](https://github.com/tobento-ch/service-queue#dispatching-jobs) section to learn more about creating jobs.

### Running Queues

[](#running-queues)

To run queues you may run the [Queue Worker](https://github.com/tobento-ch/service-queue#worker) using the `queue:work` console command.

```
php ap queue:work

```

Check out the [Queue Service - Work Command](https://github.com/tobento-ch/service-queue#work-command) section to learn more about the command.

To keep the `queue:work` process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the queue worker does not stop running.

**Alternatives**

Alternatively, you may run the `queue:work` command using the [App Schedule](https://github.com/tobento-ch/app-schedule) by using the [Command Task](https://github.com/tobento-ch/service-schedule#command-task) running every minute:

```
use Tobento\Service\Schedule\Task\CommandTask;

$task = new CommandTask(
    command: 'queue:work',
    input: [
        // you may stop the queue to work when it is empty:
        '--stop-when-empty' => null,

        // you may run only a specific queue instead of all:
        '--queue' => 'secondary',

        // it is advised to define the timeout in seconds
        // before your server times out, otherwise
        // failed jobs might not be handled.
        '--timeout' => 60,
    ],
)->cron('* * * * *');

```

### Failed Jobs

[](#failed-jobs)

By default, failed jobs will be handled by the implemented `\Tobento\App\Queue\LogFailedJobHandler::class`. Any failed job will be repushed to the queue until it reaches the maximum retries. Once it has reached the maximum retries the job will not be queued anymore and will be sent into the app log.

On the [App Logging Config](https://github.com/tobento-ch/app-logging#logging-config) file you may define a specific logger:

```
/*
|--------------------------------------------------------------------------
| Aliases
|--------------------------------------------------------------------------
*/

'aliases' => [
    \Tobento\App\Queue\LogFailedJobHandler::class => 'error',
],

```

**Custom Handler**

You can change the default behavior by creating a custom failed job handler and using the app `on` method to replace the implemented handler:

```
use Tobento\Service\Queue\FailedJobHandlerInterface;

$app->on(FailedJobHandlerInterface::class, function (): FailedJobHandlerInterface {
    return new CustomFailedJobHandler();
});

```

Credits
=======

[](#credits)

- [Tobias Strub](https://www.tobento.ch)
- [All Contributors](../../contributors)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance80

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~132 days

Recently: every ~178 days

Total

7

Last Release

105d ago

Major Versions

1.x-dev → 2.02025-10-02

PHP version history (2 changes)1.0.0PHP &gt;=8.0

2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/055d6a1b5c2384bb179c75ab0b55914231d898fdc4dffeb30770f81200e52206?d=identicon)[TOBENTOch](/maintainers/TOBENTOch)

---

Top Contributors

[![tobento-ch](https://avatars.githubusercontent.com/u/16684832?v=4)](https://github.com/tobento-ch "tobento-ch (14 commits)")

---

Tags

packagequeueappjobstobento

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tobento-app-queue/health.svg)

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

PHPackages © 2026

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