PHPackages                             rulecom/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. [Mail &amp; Notifications](/categories/mail)
4. /
5. rulecom/notifier

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

rulecom/notifier
================

Send notification via Rule and other providers

1.2.9(1y ago)045.3k—5.2%MITPHPPHP ~5.5|~7.0|~8.1|~8.2CI failing

Since Aug 31Pushed 1y ago8 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (23)Used By (0)

Rule notifier
=============

[](#rule-notifier)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fa4526851eb291a4c7402709fec326c0364cdd25953a5adfeeda6113b92399cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72756c65636f6d2f6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rulecom/notifier)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1e9dd7f2f811ee8e229b48f51605afe219efd2e7ad06716b8a93ea1e0f48ad61/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72756c65636f6d2f6e6f7469666965722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/rulecom/notifier)[![Coverage Status](https://camo.githubusercontent.com/405510b888b76c2fb4dbb6f24ff7b006bb1e79575aa955a8ee3fa6c3a9ef9521/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f72756c65636f6d2f6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/rulecom/notifier/code-structure)[![Quality Score](https://camo.githubusercontent.com/ef8790b5fe3c2389d0a0934775d887ed400f19ed6d4f5e708c146021be88ad32/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f72756c65636f6d2f6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/rulecom/notifier)[![Total Downloads](https://camo.githubusercontent.com/1c9d1061aba27fbf87117bb0f3e7359fd969b289b090947bfe06ead7dd27b914/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72756c65636f6d2f6e6f7469666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rulecom/notifier)

Send notifications via Rule (email/text message) and Slack. Inspired by Laravels notification system and can be used with the Laravel framework or completely indipendent.

Install
-------

[](#install)

Via Composer

```
$ composer require rulecom/notifier
```

Usage
-----

[](#usage)

To send notification you need to create notification objects. These objects are responsible for telling the Notifier via which channels the notification message should be sent through and what each corresponding channel message should contain.

```
use RuleCom\Notifier\Channels\Email;
use RuleCom\Notifier\Channels\Slack;

class UserHasRegistered
{
    /**
     * Here we specify through which channels we want to
     * send our notification.
    */
    public function via()
    {
        return ['email', 'slack'];
    }

    /**
     * Each via method needs a correspondng "to" method.
    */
    public function toEmail()
    {
        // Specify what the email message should contain.
    }

    /**
     * Each via method needs a correspondng "to" method.
    */
    public function toSlack()
    {
        // Specify what the Slack message should contain.
    }
}

// To send the notification to all specified channels:
$notifier = new RuleCom\Notifier\Notifier();
$notifier->send(new UserHasRegistered());
```

### Channels

[](#channels)

Currently this package supports the following channel providers:

- [Rule](https://rule.se) for sending email and text messages.
- [Slack](https://slack.com) for sending messages to Slack.

#### Email via (Rule):

[](#email-via-rule)

```
public function toEmail()
{
    return (new RuleCom\Notifier\Channels\Email(new GuzzleHttp\Client()))
        ->apikey('YOUR-RULE-API-KEY') // If using Laravel you can set this in config/rule-notifier.php
        ->subject('Hello, world!')
        ->from([
            'name' => 'John Doe',
            'email' => 'john@doe.com'
        ])
        ->to([
            'name' => 'Jane Doe',
            'email' => 'jane@doe.com'
        ])
        ->content([
            'html' => 'Notification sent via Rule!',
            'html' => 'Notification sent via Rule!'
        ]);
}
```

#### Slack:

[](#slack)

```
public function toSlack()
{
    return (new RuleCom\Notifier\Channels\Slack(new GuzzleHttp\Client()))
        ->endpoint('YOUR-SLACK-INCOMING-WEBHOOK') // If using Laravel you can set this in config/rule-notifier.php
        ->channel('#notification') // Here you can override the channel specified in Slack, or send DM by passing @username
        ->message('Hello, world!');
}
```

### Usage with Laravel

[](#usage-with-laravel)

This package can be easily integrated with laravel, with the following benefits.

- No need to pass in channel dependecies on your own.
- Ability to specify configurations such as, api key for Rule and webhook for Slack.

1. In your `config/app.php` add the following service provider

```
RuleCom\Notifier\LaravelServiceProvider::class
```

2. Publish the config:

```
php artisan vendor:publish
```

```
// Without Laravel you will have to pass the channel dependency on your own:
(new RuleCom\Notifier\Channels\Slack(new GuzzleHttp\Client()))

// With Laravel you can resolve the channels with dependencies through the ioc container:
app(RuleCom\Notifier\Channels\Slack::class)
```

### Debugging

[](#debugging)

If you need to debug a channel you may set it to debug mode. When a channel is in debug mode it will log the notification instead of dispatching the it to given channel.

To enable debug:

1. Inject `Monolog\Logger` into the channel.
2. Call the `debug` method and pass in a path to your logfile.

```
return (new RuleCom\Notifier\Channels\Slack(new GuzzleHttp\Client(), new Monolog\Logger('Notification logger')))
        ->debug('path/to/file.log') // If using Laravel you can set both debug mode and log path in config/rule-notifier.php
        ->endpoint('YOUR-SLACK-INCOMING-WEBHOOK') // If using Laravel you can set this in config/rule-notifier.php
        ->channel('#notification') // Here you can override the channel specified in Slack, or send DM by passing @username
        ->message('Hello, world!');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Matthis Stenius](https://github.com/matthisstenius)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance44

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 82.7% 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 ~239 days

Recently: every ~351 days

Total

14

Last Release

443d ago

PHP version history (4 changes)1.0.0PHP ~5.6|~7.0

1.0.2PHP ~5.5|~7.0

1.2.7PHP ~5.5|~7.0|~8.1

1.2.9PHP ~5.5|~7.0|~8.1|~8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/37244c963d1f8934343a2c9b819c7163b8032536e9541a24a572063b1b0e2bc6?d=identicon)[Rule](/maintainers/Rule)

---

Top Contributors

[![matthisstenius](https://avatars.githubusercontent.com/u/1806217?v=4)](https://github.com/matthisstenius "matthisstenius (43 commits)")[![dmitry-rule](https://avatars.githubusercontent.com/u/63600396?v=4)](https://github.com/dmitry-rule "dmitry-rule (7 commits)")[![guram-vashakidze](https://avatars.githubusercontent.com/u/44259509?v=4)](https://github.com/guram-vashakidze "guram-vashakidze (1 commits)")[![ostapchernetkiy](https://avatars.githubusercontent.com/u/102515637?v=4)](https://github.com/ostapchernetkiy "ostapchernetkiy (1 commits)")

---

Tags

notifierrulecom

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[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)

PHPackages © 2026

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