PHPackages                             cymapgt/notifier - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cymapgt/notifier

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cymapgt/notifier
================

Consistent communication interface allowing switching of 3p communication packages

3.0.0(6y ago)188[1 PRs](https://github.com/cymapgt/notifier/pulls)1BSD-3-ClausePHPPHP &gt;=7.2.0

Since May 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cymapgt/notifier)[ Packagist](https://packagist.org/packages/cymapgt/notifier)[ Docs](https://github.com/cymapgt/notifier)[ RSS](/packages/cymapgt-notifier/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (11)Used By (1)

notifier
========

[](#notifier)

Notifier interface that can be used to encapsulate 3rd party communication packages using media like email, sms, chat, messengers, voip

The notifier namespace contains libraries that implement the Notifier Interface.

This interface provides a standard set of common functions for sending communications. This can be email communications or sms communications.

For a detailed documentation on the Notifier Interface, review the Notifier API.

Usage details are provided below

Usage
=====

[](#usage)

1 Sending Email using SwiftMailer
---------------------------------

[](#1-sending-email-using-swiftmailer)

### 1.1 Prepare your Autoloader

[](#11-prepare-your-autoloader)

```
//configure the SMTP transport (wasteful but use in proto :/

// Create the Transport
$swiftMailerTransport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587, 'tls')
    ->setUsername('smtpuser@smtpserver.com')
    ->setPassword('smtppasswordhere');

```

### 1.2 Edit Your PHP Script

[](#12-edit-your-php-script)

### 1.2.1 Configure your SMTP configuration array

[](#121-configure-your-smtp-configuration-array)

These settings can be pulled from database or hard coded. User the same smtp user and password that you used to configure the SwiftMailer transport in the previous section

```
$configuration = array (
    'EMAIL_CLIENT'          => 'SwiftMailer',
    'USERNAME'              => 'smtpuser@smtpserver.com',
    'PASSWORD'              => 'smtppasswordhere',
    'HOST'                  => 'smtp.gmail.com',
    'IS_SMTP'               => true,
    'SMTP_DEBUG'            => 2,
    'SMTP_AUTH'             => true,
    'PORT'                  => 587,
    'SMTP_SECURE'           => 'tls',
    'LINE_ENDING'           => '\n',
    'CHARSET'               => 'utf-8',
    'RETURN_PATH'           => 'smptuser@smtpserver.com',
    'EMAIL_FROM'            => 'smtppasswordhere',
    'EMAIL_FROM_NAME'       => 'Cyril Ogana',
    'WORD_WRAP'             => 80,
    'IS_HTML'               => true,
    "USE_ANTIFLOOD"         => false,
    "ANTIFLOOD_FREQUENCY_MAILS"   => null,
    "ANTIFLOOD_FREQUENCY_SECONDS"   => null,
    "USE_THROTTLER"         => false,
    "THROTTLER_MAILS_PER_MINUTE" => null,
    "THROTTLER_BYTES_PER_MINUTE" => null
);

```

### 1.2.2 Build your Notifier Class and Send the messages

[](#122-build-your-notifier-class-and-send-the-messages)

```
//declare namespace usage
use cymapgt\core\utility\notifier\NotifierEmailSwiftMailerService;

//create notifier object. The swiftMailerTransport object we pass to it is the one we created in autoloader
$notifierObj = new NotifierEmailSwiftMailerService($swiftMailerTransport);

//our message is in the form of an array
$message = array (
   "TO" => array(
               array (
                   "name"  => "Cyril Ogana",
                   "email" => "cogana@gmail.com"
               )
           ),
    "SUBJECT"     =>"MY MAIL",
    "MSG_HTML"    => "Test Notifier 1:)",
    "ATTACHMENTS" => array(
         "imageAttachment" => "c:/User/Image1.jpg"
    )
);

//load our message to the notifier
$notifierObj->setMessage($message);

//send all messages
$notifierObj->sendMessagesAll(array());

```

2 Sending SMS using AfricasTalking
----------------------------------

[](#2-sending-sms-using-africastalking)

### 2.1 Edit Your PHP Script

[](#21-edit-your-php-script)

### 2.2.1 Configure your AfricasTalking configuration array

[](#221-configure-your-africastalking-configuration-array)

These settings can be pulled from database or hard coded.

```
$configuration = array(
            "SMS_CLIENT"      => "AfricasTalking",
            "USERNAME"        => "SMSUSER",
            "PASSWORD"        => "smsApiKeyHere",
            "APIKEY"          => "",
            "IS_API"          => true,
            "IS_BEHIND_PROXY" => false,
            "PROXY_AUTH"      => -1,
            "PROXY_TYPE"      => -1,
            "PROXY_SERVER"    => "",
            "PROXY_LOGIN"     => "",
            "MAX_CHARS"       => 140,
            "SMS_FROM_NAME"   => "SMSUSER"
        );

```

### 2.2.2 Build your Notifier Class and Send the messages

[](#222-build-your-notifier-class-and-send-the-messages)

Notice that configuration and message building is what is different. Details of configuring the authhentication, sending and receiving details of communications are abstracted away by the Notifier Interface

```
//declare namespace usage
use cymapgt\core\utility\notifier\NotifierSmsAfricasTalkingService;

/*create notifier object for africas talking. If you are behind a proxy, the
 *second parameter should be true, and your configuration array should contain
 *the proxy server settings
 */
$notifierObj = new NotifierSmsAfricasTalkingService($configuration, false);

//our message is in the form of an array
$message = array (
   "RECIPIENTS" => array(
       "+254723712233",
       "+254720123456",
       "+254721000999"
    ),
    "MESSAGE"     =>"MY TEST SMS :)"
);

//load our message to the notifier
$notifierObj->setMessage($message);

//send all the SMS
$notifierObj->sendMessagesAll(array());

```

Testing
=======

[](#testing)

PHPUnit Tests are provided with the package

Contribute
==========

[](#contribute)

- Email @rhossis or contact via Skype
- You will be added as author for contributions

License
=======

[](#license)

BSD-3 CLAUSE

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 63.6% 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 ~226 days

Recently: every ~340 days

Total

8

Last Release

2472d ago

Major Versions

1.0.4 → 2.0.02018-04-20

2.0.1 → 3.0.02019-09-25

PHP version history (2 changes)2.0.0PHP &gt;=7.0.0

3.0.0PHP &gt;=7.2.0

### Community

Maintainers

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

---

Top Contributors

[![cymapgt](https://avatars.githubusercontent.com/u/12482626?v=4)](https://github.com/cymapgt "cymapgt (7 commits)")[![rhossis](https://avatars.githubusercontent.com/u/7324938?v=4)](https://github.com/rhossis "rhossis (4 commits)")

---

Tags

notifier

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cymapgt-notifier/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[utopia-php/messaging

A simple, light and advanced PHP messaging library

23236.1k6](/packages/utopia-php-messaging)

PHPackages © 2026

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