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

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

maxbrokman/safe-queue
=====================

A Laravel Doctrine friendly daemonising queue worker for Laravel 5

v0.3.0(9y ago)31151.5k28[7 PRs](https://github.com/maxbrokman/SafeQueue/pulls)MITPHPPHP &gt;=5.6

Since Jul 14Pushed 3y ago5 watchersCompare

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

READMEChangelog (9)Dependencies (6)Versions (17)Used By (0)

SafeQueue
---------

[](#safequeue)

[![Latest Version on Packagist](https://camo.githubusercontent.com/19bcb936a74bb0ccd638fdc5ec605d35232150970e8a13bc73302674d587d2a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617862726f6b6d616e2f736166652d71756575652e737667)](https://packagist.org/packages/maxbrokman/safe-queue)[![Build Status](https://camo.githubusercontent.com/9b0e74453152b5a61d3006a09523486280c8c9549d8eccf4b6ef37169fb2ad42/68747470733a2f2f7472617669732d63692e6f72672f6d617862726f6b6d616e2f5361666551756575652e7376673f6272616e63683d302e33)](https://travis-ci.org/maxbrokman/SafeQueue)[![Coverage Status](https://camo.githubusercontent.com/40dd3eb437b82f40a8cb17a91938c1630d3adae8e56075348c10948ff704dac5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d617862726f6b6d616e2f5361666551756575652f62616467652e7376673f6272616e63683d302e33)](https://coveralls.io/github/maxbrokman/SafeQueue?branch=0.2)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

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

#### 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 maxbrokman/safe-queue

```

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

```
MaxBrokman\SafeQueue\DoctrineQueueProvider::class

```

##### Lumen

[](#lumen)

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

```
