Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
allow for php-event-pubsub ^3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgoslett committed May 16, 2017
1 parent aafb410 commit 07aba29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ A `SimpleEvent` is an event which takes a name and optional attributes.
// get the event manager
$manager = app('pubsub.events');

// publish an event
// dispatch an event
$event = new \Superbalist\EventPubSub\Events\SimpleEvent(
'user.created',
[
Expand All @@ -82,6 +82,27 @@ $event = new \Superbalist\EventPubSub\Events\SimpleEvent(
);
$manager->dispatch('events', $event);

// dispatch multiple events
$events = [
new \Superbalist\EventPubSub\Events\SimpleEvent(
'user.created',
[
'user' => [
// ...
],
]
),
new \Superbalist\EventPubSub\Events\SimpleEvent(
'user.created',
[
'user' => [
// ...
],
]
),
];
$manager->dispatchBatch('events', $events);

// listen for an event
$manager->listen('events', 'user.created', function (\Superbalist\EventPubSub\EventInterface $event) {
var_dump($event->getName());
Expand All @@ -107,7 +128,7 @@ A `TopicEvent` is an event which takes a topic, name, version and optional attri
// get the event manager
$manager = app('pubsub.events');

// publish an event
// dispatch an event
$event = new \Superbalist\EventPubSub\Events\TopicEvent(
'user',
'created',
Expand All @@ -123,6 +144,7 @@ $event = new \Superbalist\EventPubSub\Events\TopicEvent(
);
$manager->dispatch('events', $event);


// listen for an event on a topic
$manager->listen('events', 'user/created', function (\Superbalist\EventPubSub\EventInterface $event) {
// ...
Expand Down Expand Up @@ -159,7 +181,7 @@ The schema must be in the format `(protocol)://(......)?/events/(topic)/(channel
// get the event manager
$manager = app('pubsub.events');

// publish an event
// dispatch an event
$event = new \Superbalist\EventPubSub\Events\SchemaEvent(
'http://schemas.my-website.org/events/user/created/1.0.json',
[
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.1 - 2017-05-16

* Allow for php-event-pubsub ^3.0

## 2.0.0 - 2017-02-02

* Update `superbalist/php-event-pubsub` to ^2.0
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require": {
"php": ">=5.6.0",
"superbalist/php-event-pubsub": "^2.0",
"superbalist/php-event-pubsub": "^2.0|^3.0",
"superbalist/laravel-pubsub": "^2.0",
"illuminate/support": "^5.3"
},
Expand Down

0 comments on commit 07aba29

Please sign in to comment.