Communicator
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
Communicator is a PHP library that helps you broadcast messages over multiple
channels. This can be useful when you want to send notifcations to users via
multiple transports such as e-mail, SMS or IRC., (*2)
Install
Via Composer, (*3)
``` bash
$ composer require waltertamboer/communicator, (*4)
## Usage
Since communicator doesn't know where to send messages to, you need to implement
the `Communicator\Recipient\RecipientInterface` interface. Communicator will use
it to determine the target addresses.
``` php
$recipient = new ... // An implementation of Communicator\Recipient\RecipientInterface
$communicator = new Communicator\Communicator();
// Bind a transport. Of course this can be any transport you require.
// It's also possible to bind multiple transports to the same channel.
$communicator->bindTransport('my-channel', new Communicator\Transport\Noop\Transport());
// Now broadcast a message to all transports.
$communicator->broadcast(
[
$recipient,
],
'my-channel',
[
'my-param' => 'some param',
]
);
Change log
Please see CHANGELOG for more information on what has changed recently., (*5)
Testing
``` bash
$ composer test, (*6)
## Contributing
Install the dependencies via Docker:
```bash
docker run --rm --interactive --tty \
--volume $PWD:/app \
--volume $SSH_AUTH_SOCK:/ssh-auth.sock \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--user $(id -u):$(id -g) \
--env SSH_AUTH_SOCK=/ssh-auth.sock \
composer install
Run the unit tests:, (*7)
Just make sure the unit tests are present :-), (*8)
Credits
License
The MIT License (MIT). Please see License File for more information., (*9)