PHPackages                             onefit/events - 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. onefit/events

ActiveLibrary

onefit/events
=============

Events handling with kafka

1.2.7(5y ago)210.9k2MITPHPPHP &gt;=7.1CI failing

Since Nov 13Pushed 5y ago13 watchersCompare

[ Source](https://github.com/onefit/events)[ Packagist](https://packagist.org/packages/onefit/events)[ RSS](/packages/onefit-events/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (11)Versions (76)Used By (0)

Laravel/Lumen 5.x 6.x / Symfony 4.x 5.x Kafka Events
====================================================

[](#laravellumen-5x-6x--symfony-4x-5x-kafka-events)

[![Build Status](https://camo.githubusercontent.com/871b3d1a4a6e4f8808e9f86eb4043f5704a00e292a75a23fab88aba33143ad1a/68747470733a2f2f6669742e63692f6275696c645374617475732f69636f6e3f6a6f623d6576656e74732532466d6173746572)](https://fit.ci/job/events/job/master/)[![StyleCI](https://camo.githubusercontent.com/f5e8eaf547d0cb9200655b734ce87fef15c633b5a0dfb22bde47edca7cfe4487/68747470733a2f2f7374796c6563692e696f2f7265706f732f3232313430383133302f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/221408130)

[![Supported librdkafka versions: >= 0.11](https://camo.githubusercontent.com/aff5594ddc668d944052954b4abe022328e83f6edfa608da2c5bb36ba0cb1027/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696272646b61666b612d253345253344253230302e31312d626c75652e737667)](https://github.com/edenhill/librdkafka/releases) [![Supported Kafka versions: >= 0.8](https://camo.githubusercontent.com/9d605f7f99aa9cf133a77a819bd4b752bea963b78ef022ced32f762712bbcf7d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6b61666b612d253345253344253230302e382d626c75652e737667)](https://github.com/edenhill/librdkafka/wiki/Broker-version-compatibility) [![Supported PHP versions: 7.x](https://camo.githubusercontent.com/88ee133e54a665c66d821390487037041561325beaa4753e96656d237e626198/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253230372e782d626c75652e737667)](https://camo.githubusercontent.com/88ee133e54a665c66d821390487037041561325beaa4753e96656d237e626198/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253230372e782d626c75652e737667)

This package contains services to produce and consume events using kafka stream processing. The library supports both laravel 5.x and 6.x versions.

It also has partial [support for Symfony 4.x and 5.x versions](docs/SYMFONY.md), in which you can inject the consumer service using the bundle injection. (`OneFit\Events\Bundle\EventsBundle`)

Package uses [arnaud-lb/php-rdkafka](https://github.com/arnaud-lb/php-rdkafka) library which is a php extension wrapper around [edenhill/librdkafka](https://github.com/edenhill/librdkafka) library.

Package requirements
--------------------

[](#package-requirements)

- librdkafka &gt;= 0.11.x.
- php &gt;= 7.1
- ext-rdkafka
- ext-pcntl
- ext-json

**Important:** Events package is expecting that you have at least defined env variable *METADATA\_BROKER\_LIST* which is as its name states, a comma-separated list of the kafka brokers for your application to use, e.g. `broker-0.localhost:9092,broker-1.localhost:9092`

List of the available configuration parameters with their description can be found in [configuration overview](docs/CONFIGURATION.md).

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

[](#installation)

To get started, you just need to pull *onefit/events* package into your application.

```
composer require onefit/events

```

For the laravel applications the service is auto-discoverable, so beside pulling the package and specifying application events, there is not much to do.

For lumen applications, both *EventsServiceProvider* and *events* configuration should be manually registered inside of the *bootstrap/app.php* for given lumen application.

In a nutshell, the package is plug-and-play. After you pull the package inside of your app (most likely using `composer update onefit/events`), the only thing you need to do is to specify which of the events your application should produce. For this purpose we extended the existing laravel functionality of the observers and listeners.

The basic configuration would look something like this (*events.php*).

```
