PHPackages                             zmaglica/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. [Queues &amp; Workers](/categories/queues)
4. /
5. zmaglica/safe-queue

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

zmaglica/safe-queue
===================

A Laravel Doctrine friendly daemonising queue worker for Laravel 5

3.0.1(6y ago)1797MITPHPPHP &gt;=7.1

Since Jul 14Pushed 6y agoCompare

[ Source](https://github.com/zmaglica/SafeQueue)[ Packagist](https://packagist.org/packages/zmaglica/safe-queue)[ RSS](/packages/zmaglica-safe-queue/feed)WikiDiscussions 0.3 Synced 2d ago

READMEChangelogDependencies (6)Versions (18)Used By (0)

SafeQueue
---------

[](#safequeue)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8702896e7fb299086c29ff7ad25cb897f86c2d36fa852e7624f801609888bcbe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5a6d61676c6963612f736166652d71756575652e737667)](https://packagist.org/packages/Zmaglica/safe-queue)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

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

Forked from

#### When to use SafeQueue

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

- You use Laravel 5
- 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.\*^5.4.9#### 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 zmaglica/safe-queue

```

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

```
Zmaglica\SafeQueue\DoctrineQueueProvider::class

```

##### Lumen

[](#lumen)

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

```
