Created
November 27, 2014 17:08
-
-
Save mathiasverraes/8d91d87d40170f04868b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dispatcher = new EventDispatcher; | |
class SendWelcomeEmail implements QueuedEventHandler { | |
public function when(Event $event) { | |
// delegate to whenUserHasRegistered, whenFoo.. | |
} | |
private function whenUserHasRegistered(UserHasRegistered $event) { | |
// do stuff with $event->getUserId(); | |
} | |
} | |
$dispatcher->listen(UserHasRegistered::class, $sendWelcomeEmail); | |
$dispatcher->fire(new UserHasRegistered($userid, ...)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment