Download the PHP package nikolaposa/notify without Composer
On this page you can find all versions of the php package nikolaposa/notify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nikolaposa/notify
More information about nikolaposa/notify
Files in nikolaposa/notify
Package notify
Short Description Extensible library for building notifications and sending them via different delivery channels.
License MIT
Informations about the package notify
Notifier
Extensible library for building notifications and sending them via different delivery channels.
Installation
The preferred method of installation is via Composer. Run the following command to install
the latest version of a package and add it to your project's composer.json
:
Theory of operation
Notifications are informative messages that are sent through different channels (i.e. email, SMS, mobile push) to notify users about certain events in the application. Notification is a higher-level abstraction, a concept that encapsulates a subject to be notified to the recipient, regardless of delivery channels through which that information can be communicated. From an architectural standpoint, notification is a domain concern.
In order to minimize the coupling of your domain with the infrastructure for sending notifications, Notifier library was based on on unobtrusive interfaces that should be implemented by your objects in order to plug them into the workflow of the library. Those are:
Notification
- marks the object as a notification that can be used with the Notifier library,Recipient
- represents the recipient of the notification which provides contact (i.e. email address, phone number) for a certain channel; typically implemented by a User domain object.
For each channel through which Notification is supposed to be sent, Notification class should implement channel-specific
interface, making the Notification suitable for sending via a specific channel. These interfaces declare message
building methods, for example EmailNotification::toEmailMessage()
, that convert the notification to a message sent by
that particular channel. Channel-specific Notification interfaces extend the Notification
interface itself, so you do
not need to implement it explicitly.
Channel component captures implementation details of how a Notification is sent via certain delivery channels. Specific channel implementation typically consists of:
- channel-specific Notification interface,
- Message class - transport-level message to which Notification gets converted,
Channel
implementation responsible for the very act of sending the Notification.
Out of the box, this library features facilities for sending notifications via email and SMS. The highly extensible design allows for implementing custom delivery channels.
Finally, Notifier
service is a facade that manages the entire process of sending a Notification to a list of
Recipients via supported channels. It is the only service of this library that the calling code is supposed to interact
with directly.
Usage
Creating Notifications
Implementing Recipient
Sending Notifications
Credits
- Nikola Poša
- All Contributors
License
Released under MIT License - see the License File for details.