<commit_before>Message Bridge
=================

Message Bridge let you trigger messages from anywhere in a procedural or in an object-oriented way.
A registered callback can dispatch or forward all triggered messages.
Main idea is to support a decoupled event driven or aspect oriented application, thus object awareness to any
logger or any event dispatcher is not needed.

## Installation

The recommended way to install
[`mamuz/message-bridge`](https://packagist.org/packages/mamuz/message-bridge) is through
[composer](http://getcomposer.org/) by adding dependency to your `composer.json`:

```json
{
    "require": {
        "mamuz/message-bridge": "0.*"
    }
}
```

## Example

### Procedural

```php
// Register dispatch callback globally
setMessageDispatcher(function ($msg, $argv, $emitter) {
    if ($msg == 'user.registered') {
        mail('<EMAIL>', 'A new user entered', 'UserId ' . $argv['userId']);
    }
});

// Trigger any message anywhere
triggerMessage('user.registered', array('userId' => 1234));
```<commit_msg>complete Readme<commit_after>Message Bridge
=================

Message Bridge let you trigger messages from anywhere in a procedural or in an object-oriented way.
A registered callback can dispatch or forward all triggered messages.
Main idea is to support a decoupled event driven or aspect oriented application, thus object awareness to any
logger or any event dispatcher is not needed anymore.

## Installation

The recommended way to install
[`mamuz/message-bridge`](https://packagist.org/packages/mamuz/message-bridge) is through
[composer](http://getcomposer.org/) by adding dependency to your `composer.json`:

```json
{
    "require": {
        "mamuz/message-bridge": "0.*"
    }
}
```

## Example

### Procedural

```php
// Register dispatch callback globally
setMessageDispatcher(function ($msg, $argv, $emitter) {
    if ($msg == 'user.registered') {
        mail('<EMAIL>', 'A new user entered', 'UserId ' . $argv['userId']);
    }
});

// Trigger any message anywhere
triggerMessage('user.registered', array('userId' => 1234));
```
{'fraction_non_alphanumeric': 0.14134615384615384, 'fraction_numerical': 0.004807692307692308, 'mean_word_length': 4.4619422572178475, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1388325', 'n_tokens_mistral': 598, 'n_tokens_neox': 569, 'n_words': 206}