1. Go to this page and download the library: Download mamuz/message-bridge library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mamuz / message-bridge example snippets
// Register dispatch callback globally
set_message_dispatcher(function ($msg, $argv, $emitter) {
if ($msg == 'user.registered') {
mail('[email protected]', 'A new user entered', 'UserId ' . $argv['userId']);
}
});
// Trigger any message anywhere
trigger_message('user.registered', array('userId' => 1234));