PHPackages                             nikolaposa/notify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. nikolaposa/notify

Abandoned → [nikolaposa/notifier](/?search=nikolaposa%2Fnotifier)Library[Mail &amp; Notifications](/categories/mail)

nikolaposa/notify
=================

Extensible library for building notifications and sending them via different delivery channels.

4.0.0(6y ago)211.1k3MITPHPPHP ^7.2

Since Apr 10Pushed 6y ago5 watchersCompare

[ Source](https://github.com/nikolaposa/notifier)[ Packagist](https://packagist.org/packages/nikolaposa/notify)[ RSS](/packages/nikolaposa-notify/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (15)Used By (0)

Notifier
========

[](#notifier)

[![Build Status](https://camo.githubusercontent.com/4505069000f9742313469e1e811d298c5880dae72866eb4a66020f47326ba1d9/68747470733a2f2f7472617669732d63692e636f6d2f6e696b6f6c61706f73612f6e6f7469666965722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/nikolaposa/notifier)[![Code Quality](https://camo.githubusercontent.com/7d575de8c6654247b35437e2bc7e56bcfb41f3dd40116e8a767c8bb09ca9905e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e696b6f6c61706f73612f6e6f7469666965722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nikolaposa/notifier)[![Code Coverage](https://camo.githubusercontent.com/9e9b7327e1cef3e52c58d6bec6c274c73fa7bb92a7fc1710a32f52096aab1a39/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e696b6f6c61706f73612f6e6f7469666965722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nikolaposa/notifier/code-structure)[![Latest Version](https://camo.githubusercontent.com/759afc41c0d61521cb8735add3421353d06aafc4d3b419c77d34c3434626747d/68747470733a2f2f706f7365722e707567782e6f72672f6e696b6f6c61706f73612f6e6f7469666965722f762f737461626c65)](https://packagist.org/packages/nikolaposa/notifier)[![PDS Skeleton](https://camo.githubusercontent.com/a8ce1f2a7b71f101b18fc0393ba5bf89b7a5b1f9d08a31b658ca0eab0064c0f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e737667)](https://github.com/php-pds/skeleton)

Extensible library for building notifications and sending them via different delivery channels.

Installation
------------

[](#installation)

The preferred method of installation is via [Composer](http://getcomposer.org/). Run the following command to install the latest version of a package and add it to your project's `composer.json`:

```
composer require nikolaposa/notifier
```

Theory of operation
-------------------

[](#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:

1. `Notification` - marks the object as a notification that can be used with the Notifier library,
2. `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:

1. channel-specific Notification interface,
2. Message class - transport-level message to which Notification gets converted,
3. `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
-----

[](#usage)

**Creating Notifications**

```
namespace App\Model;

use Notifier\Channel\Email\EmailMessage;
use Notifier\Channel\Sms\SmsMessage;
use Notifier\Channel\Email\EmailNotification;
use Notifier\Channel\Sms\SmsNotification;
use Notifier\Recipient\Recipient;

class TodoExpiredNotification implements EmailNotification, SmsNotification
{
    /** @var Todo */
    protected $todo;

    public function __construct(Todo $todo)
    {
        $this->todo = $todo;
    }

    public function toEmailMessage(Recipient $recipient): EmailMessage
    {
        return (new EmailMessage())
            ->from('noreply@example.com')
            ->subject('Todo expired')
            ->htmlBody(
                'Dear ' . $recipient->getRecipientName() . ','
                . ''
                . 'Your todo: ' . $this->todo->getText() . ' has expired.'
            );
    }

    public function toSmsMessage(Recipient $recipient): SmsMessage
    {
        return (new SmsMessage())
            ->text('Todo: ' . $this->todo->getText() . ' has expired');
    }
}
```

**Implementing Recipient**

```
namespace App\Model;

use Notifier\Recipient\Recipient;

class User implements Recipient
{
    /** @var string */
    protected $name;

    /** @var array */
    protected $contacts;

    public function __construct(string $name, array $contacts)
    {
        $this->name = $name;
        $this->contacts = $contacts;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getRecipientContact(string $channel, Notification $notification): ?string
    {
        return $this->contacts[$channel] ?? null;
    }

    public function getRecipientName(): string
    {
        return $this->name;
    }
}
```

**Sending Notifications**

```
use Notifier\Channel\Channels;
use Notifier\Channel\Email\EmailChannel;
use Notifier\Channel\Email\SimpleMailer;
use Notifier\Channel\Sms\SmsChannel;
use Notifier\Channel\Sms\TwilioTexter;
use Notifier\Notifier;
use Notifier\Recipient\Recipients;

$notifier = new Notifier(new Channels(
    new EmailChannel(new SimpleMailer()),
    new SmsChannel(new TwilioTexter('auth_id', 'auth_token'))
));

$notifier->send(
    new TodoExpiredNotification($todo),
    new Recipients($user1, $user2, $user3)
);
```

Credits
-------

[](#credits)

- [Nikola Poša](https://github.com/nikolaposa)
- [All Contributors](../../contributors)

License
-------

[](#license)

Released under MIT License - see the [License File](LICENSE) for details.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~112 days

Recently: every ~358 days

Total

14

Last Release

2227d ago

Major Versions

1.2.1 → 2.0.02016-04-17

2.2.0 → 3.0.02016-09-06

3.0.1 → 4.0.02020-04-05

PHP version history (2 changes)1.0.0-betaPHP &gt;=5.6

4.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/af5242d5454968c532cb32c3855f182f92ea1f833a67c03088aca866ddfb6ef6?d=identicon)[nikolaposa](/maintainers/nikolaposa)

---

Top Contributors

[![nikolaposa](https://avatars.githubusercontent.com/u/6012807?v=4)](https://github.com/nikolaposa "nikolaposa (218 commits)")

---

Tags

emailnotificationssmsemailnotificationnotifiersms

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nikolaposa-notify/health.svg)

```
[![Health](https://phpackages.com/badges/nikolaposa-notify/health.svg)](https://phpackages.com/packages/nikolaposa-notify)
```

###  Alternatives

[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[symfony/fake-sms-notifier

Fake SMS (as email or log during development) Notifier Bridge.

27754.2k1](/packages/symfony-fake-sms-notifier)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)[nikolaposa/notifier

Extensible library for building notifications and sending them via different delivery channels.

211.6k](/packages/nikolaposa-notifier)[hooman-mirghasemi/laravel-iran-sms

Laravel Sms

241.8k](/packages/hooman-mirghasemi-laravel-iran-sms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
