PHPackages                             robinvdvleuten/lazy-event-dispatcher - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. robinvdvleuten/lazy-event-dispatcher

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

robinvdvleuten/lazy-event-dispatcher
====================================

An event dispatcher that holds any events until flushed.

v1.1.0(7y ago)14.5k[1 issues](https://github.com/robinvdvleuten/php-lazy-event-dispatcher/issues)MITPHPPHP ^7.0

Since May 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/robinvdvleuten/php-lazy-event-dispatcher)[ Packagist](https://packagist.org/packages/robinvdvleuten/lazy-event-dispatcher)[ Docs](https://github.com/robinvdvleuten/php-lazy-event-dispatcher)[ RSS](/packages/robinvdvleuten-lazy-event-dispatcher/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

LazyEventDispatcher
===================

[](#lazyeventdispatcher)

An event dispatcher that holds any events until flushed.

[![Latest Stable Version](https://camo.githubusercontent.com/17b5b3cf0e6b9f0d09a382afd1530a3532a29aeb16f5bf0d84d0a2901434c913/68747470733a2f2f706f7365722e707567782e6f72672f726f62696e7664766c657574656e2f6c617a792d6576656e742d646973706174636865722f762f737461626c65)](https://packagist.org/packages/robinvdvleuten/lazy-event-dispatcher)[![Build Status](https://camo.githubusercontent.com/512ebad27cfe9407daa682582b9bd73405449df4f822c9553a3830efc8365392/68747470733a2f2f7472617669732d63692e6f72672f726f62696e7664766c657574656e2f7068702d6c617a792d6576656e742d646973706174636865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/robinvdvleuten/php-lazy-event-dispatcher)

Use Case
--------

[](#use-case)

If you want to make use of the [kernel.terminate](http://symfony.com/doc/current/components/http_kernel.html#the-kernel-terminate-event) event to do some "heavy" action after the response has already streamed back to the client. Symfony does this already by default but with this listener you'll have support for any custom event classes.

Installation
------------

[](#installation)

The recommended way to install the library is through [Composer](http://getcomposer.org).

```
composer require robinvdvleuten/lazy-event-dispatcher
```

Install the listener as a service afterwards;

```
services:
    app.lazy_event_dispatcher:
        class: Rvdv\LazyEventDispatcher\LazyEventDispatcher
        arguments:
          - "@event_dispatcher"
        tags:
          - { name: kernel.event_listener, event: kernel.terminate, method: flush }
```

Then add a custom compiler pass to have a new event listener type;

```
