Download the PHP package superbalist/laravel-event-pubsub without Composer
On this page you can find all versions of the php package superbalist/laravel-event-pubsub. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download superbalist/laravel-event-pubsub
More information about superbalist/laravel-event-pubsub
Files in superbalist/laravel-event-pubsub
Package laravel-event-pubsub
Short Description An event protocol and implementation over pub/sub for Laravel
License MIT
Informations about the package laravel-event-pubsub
laravel-event-pubsub
An event protocol and implementation over pub/sub for Laravel.
This package is a wrapper bridging php-event-pubsub into Laravel. It builds on top of the existing laravel-pubsub package adding support for publishing and subscribing to events over pub/sub.
If you aren't familiar with the laravel-pubsub
package, it's worth first taking a look at their documentation.
For Laravel 4 support, use the package https://github.com/Superbalist/laravel4-event-pubsub
Installation
The package has a default configuration which uses the following environment variables.
If the PUBSUB_EVENTS_CONNECTION
environment variable or pubsub_events.default
config value is left blank, the
default connection will be taken from the laravel-pubsub
package config.
Register the service provider in app.php
Register the facade in app.php
To customize the configuration file, publish the package configuration using Artisan.
You can then edit the generated config at app/config/pubsub_events.php
.
Usage
Simple Events
A SimpleEvent
is an event which takes a name and optional attributes.
Topic Events
A TopicEvent
is an event which takes a topic, name, version and optional attributes.
Schema Events
A SchemaEvent
is an extension of the TopicEvent
and takes a schema and optional attributes. The topic, name and
version are derived from the schema.
The schema must be in the format (protocol)://(......)?/events/(topic)/(channel)/(version).json
Error Handling
The library supports error handlers for when event translation fails, listen expression fails and validation fails.
These are configurable as callables in the translate_fail_handler, listen_expr_fail_handler and validation_fail_handler config options.
The config contains default callables which will turn the callbacks into Laravel events.
You can register listeners in the EventServiceProvider for the following events:
All versions of laravel-event-pubsub with dependencies
superbalist/php-event-pubsub Version ^4.0
superbalist/laravel-pubsub Version ^2.0|^3.0
illuminate/support Version ^5.3
illuminate/events Version ^5.3