PHPackages                             rias/craft-notifications - 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. rias/craft-notifications

Abandoned → [percipioglobal/craft-notifications](/?search=percipioglobal%2Fcraft-notifications)Craft-plugin[Mail &amp; Notifications](/categories/mail)

rias/craft-notifications
========================

Send notifications across a variety of delivery channels, including mail and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.

4.1.2(3y ago)5523.4k↑25%9[3 PRs](https://github.com/craftpulse/craft-notifications/pulls)2MITPHPPHP ^8.0.2CI failing

Since Jan 14Pushed 10mo ago4 watchersCompare

[ Source](https://github.com/craftpulse/craft-notifications)[ Packagist](https://packagist.org/packages/rias/craft-notifications)[ RSS](/packages/rias-craft-notifications/feed)WikiDiscussions v5 Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (34)Used By (2)

[![icon](./resources/img/banner.png)](./resources/img/banner.png)

Notifications plugin for Craft CMS 5.x
======================================

[](#notifications-plugin-for-craft-cms-5x)

Send notifications across a variety of delivery channels, including mail and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.

1. [Installation](#installation)
2. [Introduction](#introduction)
3. [Sending notifications](#sending-notifications)
4. [Database notifications](#database-notifications)
    1. [Retrieving notifications](#retrieving-notifications)
    2. [Marking notifications as read](#marking-notifications-as-read)
5. [Delete notifications](#delete-notifications)
6. [Mail notifications](#mail-notifications)
7. [Slack notifications](#slack-notifications)
    1. [Formatting slack notifications](#formatting-slack-notifications)
    2. [Customizing the Sender &amp; Recipient](#customizing-the-sender-&-recipient)
    3. [Slack attachments](#slack-attachments)
    4. [Markdown attachment content](#markdown-attachment-content)
8. [Notification events](#notification-events)
9. [Custom channels](#custom-channels)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 5.0.0 or later.

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

[](#installation)

To install Notifications, follow these steps:

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require craftpulse/craft-notifications

    ```
3. Install the plugin via `./craft install/plugin notifications` via the CLI, or in the Control Panel, go to Settings → Plugins and click the “Install” button for Password Policy.

You can also install Notifications via the **Plugin Store** in the Craft Control Panel.

Notifications works on Craft 5.x.

4. Copy the `config.php` file to `config/notifications.php` in your application.
5. Make sure your notifications are autoloaded by adding the following to your `composer.json` and runnning `composer dump -o`

```
"autoload": {
    "psr-4": {
        "app\\notifications\\": "./notifications"
    }
},

```

Introduction
------------

[](#introduction)

Typically, notifications should be short, informational messages that notify users of something that occurred in your application. For example, if you are writing a billing application, you might send an "Invoice Paid" notification to your users via the email and SMS channels.

Creating notifications
----------------------

[](#creating-notifications)

Each notification is represented by a single class (stored in the `notifications` directory of your application). You will have to create it manually or it will be created for you when you run the `notifications/make` command:

```
./craft notifications/make BlogPostAdded

```

This command will place a fresh notification class in your `notifications` directory. Each notification class contains a `via` method and a variable number of message building methods (such as `toMail` or `toDatabase`) that convert the notification to a message optimized for that particular channel.

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

[](#sending-notifications)

Notifications can be sent in two ways, either from the configuration file when an `event` is fired, or from your own plugins.

First, let's show how you configure sending a notification when for example a new blogpost is added:

```
