PHPackages                             bakkerij/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. bakkerij/notifier

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

bakkerij/notifier
=================

Notifier plugin for CakePHP

1.2.1(9y ago)5889337[5 PRs](https://github.com/bakkerij/notifier/pulls)PHPPHP &gt;=5.4.16

Since Sep 26Pushed 7y ago13 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

Notifier plugin for CakePHP
===========================

[](#notifier-plugin-for-cakephp)

[![Travis](https://camo.githubusercontent.com/3bd7b4ea8e59b109d257eff5fd1ea585f30b8da8b1fdc74b81e3d4c077babe13/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62616b6b6572696a2f6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bakkerij/notifier)[![Packagist](https://camo.githubusercontent.com/3b808b0d560afc824003f8c8f166e8ea2733af6eeaab089dfcd491909c4f37f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616b656d616e616765722f63616b657068702d6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bakkerij/notifier)[![Packagist](https://camo.githubusercontent.com/5303e9856e255e038157c91f01e16a34074f09ecc2f4207a8b9331e49563f28b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62616b6b6572696a2f6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bakkerij/notifier)[![Gitter](https://camo.githubusercontent.com/f14b2aea8faad1293c27ab120634acff7969fdef9a0379c0f83dbf09d66e0551/68747470733a2f2f696d672e736869656c64732e696f2f6769747465722f726f6f6d2f62616b6b6572696a2f6e6f7469666965722e6a732e7376673f7374796c653d666c61742d737175617265)](https://gitter.im/bakkerij/notifier)

This plugin allows you to integrate a simple notification system into your application.

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install this plugin as composer package is:

```
    composer require bakkerij/notifier

```

Now load the plugin via the following command:

```
    bin/cake plugin load -b Bakkerij/Notifier

```

After loading the plugin you need to migrate the tables for the plugin using:

```
    bin/cake migrations migrate -p Bakkerij/Notifier

```

Sending notifications
---------------------

[](#sending-notifications)

#### Templates

[](#templates)

Before sending any notification, we need to register a template. An example about how to add templates:

```
    $notificationManager->addTemplate('newBlog', [
        'title' => 'New blog by :username',
        'body' => ':username has posted a new blog named :name'
    ]);
```

When adding a new template, you have to add a `title` and a `body`. Both are able to contain variables like `:username`and `:name`. Later on we will tell more about these variables.

#### Notify

[](#notify)

Now we will be able to send a new notification using our `newBlog` template.

```
    $notificationManager->notify([
        'users' => [1, 2],
        'recipientLists' => ['administrators'],
        'template' => 'newBlog',
        'vars' => [
            'username' => 'Bob Mulder',
            'name' => 'My great new blogpost'
        ]
    ]);
```

> Note: You are also able to send notifications via the component: `$this->Notifier->notify()`.

With the `notify` method we sent a new notification. A list of all attributes:

- `users` - This is an integer or array filled with id's of users to notify. So, when you want to notify user 261 and 373, add `[261, 373]`.
- `recipientLists` - This is a string or array with lists of recipients. Further on you can find more about RecipientLists.
- `template` - The template you added, for example `newBlog`.
- `vars` - Variables to use. In the template `newBlog` we used the variables `username` and `name`. These variables can be defined here.

#### Recipient Lists

[](#recipient-lists)

To send notifications to large groups you are able to use RecipientLists. You can register them with:

```
    $notificationManager->addRecipientList('administrators', [1,2,3,4]);
```

Now we have created a list of recipients called `administrators`.

This can be used later on when we send a new notification:

```
    $notificationManager->notify([
        'recipientLists' => ['administrators'],
    ]);
```

Now, the users 1, 2, 3 and 4 will receive a notification.

Retrieving notifications
------------------------

[](#retrieving-notifications)

#### Lists

[](#lists)

You can easily retrieve notifications via the `getNotifications` method. Some examples:

```
    // getting a list of all notifications of the current logged in user
    $this->Notifier->getNotifications();

    // getting a list of all notifications of the user with id 2
    $this->Notifier->getNotifications(2);

    // getting a list of all unread notifications
    $this->Notifier->allNotificationList(2, true);

    // getting a list of all read notifications
    $this->Notifier->allNotificationList(2, false);
```

#### Counts

[](#counts)

Getting counts of read/unread notifications can be done via the `countNotifications` method. Some examples:

```
    // getting a number of all notifications of the current logged in user
    $this->Notifier->countNotifications();

    // getting a number of all notifications of the user with id 2
    $this->Notifier->countNotifications(2);

    // getting a number of all unread notifications
    $this->Notifier->countNotificationList(2, true);

    // getting a number of all read notifications
    $this->Notifier->countNotificationList(2, false);
```

#### Mark as read

[](#mark-as-read)

To mark notifications as read, you can use the `markAsRead` method. Some examples:

```
    // mark a single notification as read
    $this->Notifier->markAsRead(500;

    // mark all notifications of the given user as read
    $this->Notifier->markAsRead(null, 2);
```

#### Notification Entity

[](#notification-entity)

The following getters can be used at your notifications entity:

- `title` - The generated title including the variables.
- `body` - The generated body including the variables.
- `unread` - Boolean if the notification is not read yet.
- `read` - Boolean if the notification is read yet.

Example:

```
    // returns true or false
    $entity->get('unread');

    // returns the full output like 'Bob Mulder has posted a new blog named My Great New Post'
    $entity->get('body');
```

#### Passing to view

[](#passing-to-view)

You can do something like this to use the notification list in your view:

```
    $this->set('notifications', $this->Notifier->getNotifications());
```

Notification Manager
--------------------

[](#notification-manager)

The `NotificationManager` is the Manager of the plugin. You can get an instance with:

```
    NotificationManager::instance();
```

The `NotificationManager` has the following namespace: `Bakkerij\Notifier\Utility\NotificationManager`.

The manager has the following methods available:

- `notify`
- `addRecipientList`
- `getRecipientList`
- `addTemplate`
- `getTemplate`

Notifier Component
------------------

[](#notifier-component)

The `Bakkerij/Notifier.Notifier` component can be used in Controllers:

```
    public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Bakkerij/Notifier.Notifier');
    }
```

The component has the following methods available:

- `getNotifications`
- `countNotifications`
- `markAsRead`
- `notify`

Keep in touch
-------------

[](#keep-in-touch)

If you need some help or got ideas for this plugin, feel free to chat at [Gitter](https://gitter.im/bakkerij/notifier).

Pull Requests are always more than welcome!

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 84.8% 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 ~108 days

Total

4

Last Release

3559d ago

### Community

Maintainers

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

---

Top Contributors

[![bobmulder](https://avatars.githubusercontent.com/u/5465074?v=4)](https://github.com/bobmulder "bobmulder (39 commits)")[![leoruhland](https://avatars.githubusercontent.com/u/1785552?v=4)](https://github.com/leoruhland "leoruhland (2 commits)")[![b1scuit](https://avatars.githubusercontent.com/u/2174593?v=4)](https://github.com/b1scuit "b1scuit (1 commits)")[![hillelectric](https://avatars.githubusercontent.com/u/19555464?v=4)](https://github.com/hillelectric "hillelectric (1 commits)")[![jpkleemans](https://avatars.githubusercontent.com/u/5700014?v=4)](https://github.com/jpkleemans "jpkleemans (1 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (1 commits)")[![Brandon1811](https://avatars.githubusercontent.com/u/23064902?v=4)](https://github.com/Brandon1811 "Brandon1811 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[dereuromark/cakephp-shim

A CakePHP plugin to shim applications between major framework versions.

401.0M11](/packages/dereuromark-cakephp-shim)[cakedc/cakephp-phpstan

CakePHP plugin extension for PHPStan.

40676.6k31](/packages/cakedc-cakephp-phpstan)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)[dereuromark/cakephp-geo

A CakePHP plugin around geocoding tools and helpers.

51174.9k4](/packages/dereuromark-cakephp-geo)

PHPackages © 2026

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