notifier/notifier

Send notifications using any delivery method.

Installs: 1 468

Dependents: 3

Stars: 13

Watchers: 3

Forks: 8

Open Issues: 12

Language: PHP

1.0.0 2013-08-16 16:52 UTC

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version Dependency Status License

Using this library, you can send messages to users following their preffered channels. This will help you focus on your application code and leave the message sending to your Notifier implementation.

Caution: Only use < 2.0 in production!

Use Case

Say you want your users to choose how they receive notifications from your application. For example on a new private message you have them choose SMS, email or both. Notifier will help you handle these choices. From within your application you don't need to worry about what delivery type the user chose. You just send the message indicating what type the message is and Notifier will resolve the correct channels and send it.

Example

This is an example of the implementation of the MailChannel.

use Notifier\Mail\ParameterBag\MailMessageParameterBag;
use Notifier\Mail\ParameterBag\MailRecipientParameterBag;
use Notifier\Recipient\Recipient;
use Notifier\Message\Message;
use Notifier\Notifier;

$message = new Message(new InformationType());
$message->addParameterBag(new MailMessageParameterBag('Mail subject', 'Body...'));

$recipient = new Recipient();
$recipient->addParameterBag(new MailRecipientParameterBag('someone@example.com'));

// The ChannelResolver will decide to which channels a message of a specific type must be sent.
$notifier = new Notifier(new RecoverPasswordChannelResolver());
$notifier->sendMessage($message, array($recipient));

Current state

The project is in active development of 2.0.x. Please refer to 1.0.x if you want to use this in production.

Channels

Notifier is stripped of most channels. You can find a list of all available channels.

Contributing

All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a feature branch, and send us a pull request.

To ensure a consistent code base, you should make sure the code follows the Coding Standards which we borrowed from Symfony. Make sure to check out php-cs-fixer as this will help you a lot.

If you would like to help take a look at the list of issues.

Requirements

PHP 5.3.2 or above

Author and contributors

Dries De Peuter - dries@nousefreak.be - http://nousefreak.be

See also the list of contributors who participated in this project.

License

Notifier is licensed under the MIT license.