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

ActiveCraft-plugin[Mail &amp; Notifications](/categories/mail)

mayocube/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.

5.0.0(1y ago)1284↓50%MITPHPPHP ^8.2

Since Aug 17Pushed 1y agoCompare

[ Source](https://github.com/mayocube/craft-notifications)[ Packagist](https://packagist.org/packages/mayocube/craft-notifications)[ RSS](/packages/mayocube-craft-notifications/feed)WikiDiscussions v4 Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

THIS IS A COPY OF CRAFTPULSE/CRAFTNOTIFICATION, with a maintainer!
==================================================================

[](#this-is-a-copy-of-craftpulsecraftnotification-with-a-maintainer)

[![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)

Support Open Source. Buy beer.
------------------------------

[](#support-open-source-buy-beer)

This plugin is licensed under a MIT license, which means that it's completely free open source software, and you can use it for whatever and however you wish. If you're using it and want to support the development, buy me a beer over at Beerpay!

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

[](#requirements)

This plugin requires Craft CMS 5.0.0 or later.

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

[](#installation)

To install the plugin, follow these instructions.

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

    ```
     cd /path/to/project

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

    ```
     composer require mayocube/craft-notifications

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Notifications.
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:

```
