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

ActiveLibrary

lwk/safe-queue
==============

A Laravel Doctrine friendly daemonising queue worker for Laravel

v2.0.0(1y ago)014MITPHPPHP ^8.1|^8.2|^8.3

Since Aug 3Pushed 1y agoCompare

[ Source](https://github.com/dpslwk/safe-queue)[ Packagist](https://packagist.org/packages/lwk/safe-queue)[ RSS](/packages/lwk-safe-queue/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (2)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.02.0.0^10.0 &amp; ^11.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');`

```
