PHPackages                             cryptoman3/safe-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. cryptoman3/safe-queue

ActiveLibrary

cryptoman3/safe-queue
=====================

A Laravel Doctrine friendly daemonising queue worker for Laravel

v4(1y ago)02.0k↓100%MITPHPPHP ^7.4 || ^8.2 || ^8.3 || ^8.4

Since May 17Pushed 1y agoCompare

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

READMEChangelog (5)Dependencies (5)Versions (6)Used By (0)

SafeQueue
---------

[](#safequeue)

A Laravel Queue worker that's safe for use with Laravel Doctrine

#### When to use SafeQueue

[](#when-to-use-safequeue)

- You use Laravel 6 or up
- You use Laravel Doctrine
- Devops say the CPU usage of `queue:listen` is unacceptable
- You want to do `php artisan queue:work --daemon` without hitting cascading `EntityManager is closed` exceptions

#### Compatibility

[](#compatibility)

VersionSupported Laravel Versions0.1.\*5.1, 5.20.2.\*^5.3.160.3.\*&gt; 5.4 &amp; &lt;=5.8.\*0.4.\*^6.0 &amp; ^7.00.5.\*^8.0#### How it Works

[](#how-it-works)

SafeQueue overrides a small piece of Laravel functionality to make the queue worker daemon safe for use with Doctrine. It makes sure that the worker exits if the EntityManager is closed after an exception. For good measure it also clears the EM before working each job.

#### Installation

[](#installation)

Install using composer

```
composer require digbang/safe-queue

```

Once you've got the codez add the following to your service providers in `app.php`

```
Digbang\SafeQueue\DoctrineQueueProvider::class

```

##### Lumen

[](#lumen)

Create the config file `config/safequeue.php` and load it: `$app->configure('safequeue');`

```
