PHPackages                             imagina/inotification - 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. imagina/inotification

ActiveAsgard-module

imagina/inotification
=====================

Module handling the real time notifications

10.0.0(1y ago)048[1 PRs](https://github.com/imagina/asgardcms-inotifications/pulls)MITPHPPHP ^8.1

Since Dec 11Pushed 7mo ago4 watchersCompare

[ Source](https://github.com/imagina/asgardcms-inotifications)[ Packagist](https://packagist.org/packages/imagina/inotification)[ RSS](/packages/imagina-inotification/feed)WikiDiscussions v10.x Synced 2mo ago

READMEChangelog (1)Dependencies (8)Versions (22)Used By (0)

Inotification module 4.1.1
==========================

[](#inotification-module-411)

Improved version of the Asgard Notification Module -

\##Realease Notes

### Added

[](#added)

- Rules `CreateNotificationRequest`
- Validation message for request rules
- `Labs Mobile` default provider for SMS notifications
- `Provider`, `Rule`, `Template` and `TypeNotification` Asgard Entities Scaffold
- `defaultEmailView` config
- `provider` and `recipient` columns into `notification__notifications` table
- `notificationTypes` config to be seeded in the notification\_\_notification\_types table
- `providers` config to add new providers configurations
- `NotificationTypeTableSeeder` depending on the config
- `EventServiceProvider` to listening dynamically all the events defined in the config `providers`
- `NotificationHandler` to handle all the events listened by the `EventServiceProvider`
- `Rule->conditions` validations
- `ImaginaNotification` improved version of the `AsgardNotification`

> Note
>
> with the new `ImaginaNotification` service, the column `user_id` was replaced by `recipient` in the table `notification__notifications`

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

[](#installation)

### Composer

[](#composer)

Execute the following command in your terminal:

```
composer require imagina/asgardcms-inotifications
```

> Note
>
> After installation you'll have to give you the required permissions to get to the blog module pages in the backend.\*\*

#### Run migrations and seeders

[](#run-migrations-and-seeders)

```
php artisan module:migrate notification --seed
```

### Providers configuration

[](#providers-configuration)

\#####[/Config/config.php](/Config/config.php)

OptionDescriptionRequirednameName to show in frontend administratorYessystemNameName to use in backendYesiconIcon to use in frontend administratorNocolorColor to use in frontend administratorNorulesRules to validate the recipient, see the [available rules](https://laravel.com/docs/5.5/validation#available-validation-rules)NofieldsFields necessary to configure the provider, see the [Provider Fields](https://github.com/imagina/asgardcms-inotifications#provider-fields)Yessettingsthe available settings for each rulesNo### Provider Fields

[](#provider-fields)

All the fields necessary to configure the provider: api keys, login, user names, passwords.

Each field need to be defined with the `dynamic fields` configuration in the [basequasar-app](https://github.com/imagina/basequasar-app). Here a list of the fields required:

OptionDescriptionRequiredidit's necessary to the crud in frontend, only the `value` it's necessary: `  ["id" => ['value' => null]`Yesstatusa select field with Enable/Disable options ('1' or '0')Yesdefaulta checkbox field for the default provider by type of notificationYestypeType of the notification, defined in the config `notificationTypes` and seeded in the `notification__notification_types`YessaveInDatabaserequired field for save in the `notification__notifications` table or notYes> Note
>
> Each Provider field can define the route to the public config to replace the keys from ENV file, just add the configRoute value:

```
// example: broadcasting pusher config route
"configRoute" => "broadcasting.connections.pusher.options.encrypted"
```

this setting is only used at the time of sending a notification, the rest of the application will continue to use the settings from the .env file.

### Provider Settings

[](#provider-settings)

The settings necessary to customize the fields of the provider for each Rule

Each setting need to be defined with the `dynamic fields` configuration in the [basequasar-app](https://github.com/imagina/basequasar-app). Here a list of the settings required:

OptionDescriptionRequiredstatusa select field with Enable/Disable options ('1' or '0')YessaveInDatabaserequired field for save in the `notification__notifications` table or notYes> Note
>
> the required fields of the Provider have more precedence over the Rule Settings.

### Publish the configuration

[](#publish-the-configuration)

```
php artisan module:publish-config notification
```

Usage
-----

[](#usage)

There is two ways for use the sending of notifications:

\###1 Quickly send notifications to your frontend application.

Inject the `Modules\Notification\Services\Inotification` interface where you need it and assign it to a class variable.

```
    // New Service Inotification
    use Modules\Notification\Services\Inotification;

    /**
    *  by type, to user->id recipient
    */
     $this->notification->type('broadcast')->to($user->id)
    ->push(
      [
        "title" => "test notification",
        "message" => "message notification",
        "icon_class" => "fas fa-test",
        "link" => url(''),
        "setting" => [
          "saveInDatabase" => 1 // now, the notifications with type broadcast need to be save in database to really send the notification
        ]
      ]
    );

/**
 *  by mutiple types, to user->id recipient
 */
  $this->notification->type(['broadcast', 'push'])->to($user->id)
    ->push(
      [
        "title" => "test notification",
        "message" => "message notification",
        "icon_class" => "fas fa-test",
        "link" => url(''),
        "setting" => [
          "saveInDatabase" => 1 // now, the notifications with type broadcast need to be save in database to really send the notification
        ]
      ]
    );

/**
*  by provider, to user->email recipient
*/
$this->notification->provider('email')->to($user->email)
  ->push(
    [
      "title" => "test notification",
      "message" => "message notification",
      "icon_class" => "fas fa-test",
      "link" => url(''),
      "view" => "email.view"
    ]
  );

/**
  *  by mutiple types defined in the to
  */
  $this->notification->to([
    "broadcast" => $user->id,
    "email" => $user->email,
  ])->push(
      [
        "title" => "test notification",
        "message" => "message notification",
        "icon_class" => "fas fa-test",
        "link" => url(''),
        "view" => "email.view",
        "setting" => [
          "saveInDatabase" => 1 // now, the notifications with type broadcast need to be save in database to really send the notification
        ]
      ]
  );

```

### 2 Using Events and defining the Notifiable config in each module to administrate from the database by the Rules

[](#2-using-events-and-defining-the-notifiable-config-in-each-module-to-administrate-from-the-database-by-the-rules)

#### Notifiable Configuration

[](#notifiable-configuration)

First in each module you need to define the Notifiable config, the Notification module will be detect the configuration and will sending to the frontend for the creation of the Rules, each Rule need to be saved in the database for having effect.

OptionDescriptionRequiredtitleName of the entity to show in frontend administratorYesentityNameClass Path Name for an unique name for the notifiable, example: `Modules\\ModuleName\\Entities\\EntityName`YeseventsArray of arrays for all the events notifiable to the entity, only needs the `title` (for the frontend) and `path` (class path name)YesconditionsConditions to validate the Rule, if is empty the Rule will be executed without restrictions, see the [Notifiable conditions configuration](https://github.com/imagina/asgardcms-inotifications#notifiable-conditions-configuration)Nosettingsarray to add options to the provider settingsNo#### Notifiable conditions configuration

[](#notifiable-conditions-configuration)

The conditions are configured like the dynamic fields of the basequasar-app. however, there are only 3 types of conditions available:

1 recursive

```
"EMail" => [
  "name" => "EMail",
  'value' => [
    "comparator" => "",
    "value" => ""
  ],
  'type' => 'recursive',
  "fields" => [
    "operator" => [
      "name" => "operator",
      'value' => 'any',
      'type' => 'select',
      'props' => [
        'label' => 'Email',
        'options' => [
          ['label' => 'Any', 'value' => 'any'],
          ['label' => 'Contains', 'value' => 'contains'],
          ['label' => 'Exact Match', 'value' => 'exactMatch']
        ]
      ],
    ],
    "value" => [
      "name" => "value",
      'value' => '',
      'type' => 'text',
      'props' => [
        'label' => ''
      ],
    ],
    "type" => [
      "name" => "type",
      'value' => 'comparatorSimple',
      'type' => 'hidden',
      'props' => [
        'label' => ''
      ],
    ]
  ]

],
```

2 select with static options

```
"NinetyMin" => [
  "name" => "NinetyMin",
  'value' => 'any',
  'type' => 'select',
  'props' => [
    'label' => 'Ninety Min',
    'options' => [
      ['label' => 'Any', 'value' => 'any'],
      ['label' => 'Yes', 'value' => 'Y'],
      ['label' => 'No', 'value' => 'N']
    ]
  ],
],
```

3 select with dynamic options

```
"idSource" => [
  "name" => "idSource",
  'value' => 'any',
  'type' => 'select',
  'loadOptions' => [
    'apiRoute' => 'apiRoutes.setup.sources',
    'select' => ['label' => 'title', 'id' => 'id']
  ],
  'options' => [
    ['label' => 'Any', 'value' => 'any'],
  ],
  'props' => [
    'label' => 'Source'
  ],
],
```

> Note
>
> All conditions require the `any` default value, the handle detects it and validates it

\##Event Example

```
namespace Modules\Iteam\Events;

class UserWasJoined
{
    public $user;
    public $team;

    // this attribute it's required
    public $entity;

    /**
     * Create a new event instance.
     *
     * @param $entity
     * @param array $data
     */
    public function __construct($user,$team)
    {
        $this->user = $user;
        $this->entity = $team;
        $this->team = $team;
    }

  // this method it's required

  public function notification(){

    return [
      "title" =>  "¡Buenas Noticias!, te han aceptado en el equipo: ".$this->team->title,
      "message" =>   "Has sido aceptado en el equipo: ".$this->team->title,
      "icon_class" => "fas fa-glass-cheers",
      "link" => "link",
      "view" => "iteam::emails.userJoined.userJoined",
      "recipients" => [
        "email" => [$this->user->email],
        "broadcast" => [$this->user->id],
        "push" => [$this->user->id],
      ],

      // here you can send all objects and params necessary to the view template
      "user" => $this->user,
      "team" => $this->team
    ];
  }

}
```

Notifiable Config Example
-------------------------

[](#notifiable-config-example)

```
  'notifiable' => [

    [
      "title" => "Lead Opportunity",
      "entityName" => "Modules\\Ilead\\Entities\\LeadOpportunity",
      "events" => [
        [
          "title" => "New Lead Opportunity was created",
          "path" => "Modules\\Ilead\\Events\\LeadOpportunityWasCreated"
        ]
      ],

      "conditions" => [
        "EMail" => [
          "name" => "EMail",
          'value' => [
            "comparator" => "",
            "value" => ""
          ],
          'type' => 'recursive',
          "fields" => [
            "operator" => [
              "name" => "operator",
              'value' => 'any',
              'type' => 'select',
              'props' => [
                'label' => 'Email',
                'options' => [
                  ['label' => 'Any', 'value' => 'any'],
                  ['label' => 'Contains', 'value' => 'contains'],
                  ['label' => 'Exact Match', 'value' => 'exactMatch']
                ]
              ],
            ],
            "value" => [
              "name" => "value",
              'value' => '',
              'type' => 'text',
              'props' => [
                'label' => ''
              ],
            ],
            "type" => [
              "name" => "type",
              'value' => 'comparatorSimple',
              'type' => 'hidden',
              'props' => [
                'label' => ''
              ],
            ]
          ]

        ],
        "NinetyMin" => [
          "name" => "NinetyMin",
          'value' => 'any',
          'type' => 'select',
          'props' => [
            'label' => 'Ninety Min',
            'options' => [
              ['label' => 'Any', 'value' => 'any'],
              ['label' => 'Yes', 'value' => 'Y'],
              ['label' => 'No', 'value' => 'N']
            ]
          ],
        ],
        "idSource" => [
          "name" => "idSource",
          'value' => 'any',
          'type' => 'select',
          'loadOptions' => [
            'apiRoute' => 'apiRoutes.setup.sources',
            'select' => ['label' => 'title', 'id' => 'id']
          ],
          'options' => [
            ['label' => 'Any', 'value' => 'any'],
          ],
          'props' => [
            'label' => 'Source'
          ],
        ],
        "idStore" => [
          "name" => "idStore",
          'value' => 'any',
          'type' => 'select',
          'loadOptions' => [
            'apiRoute' => 'apiRoutes.setup.stores',
            'select' => ['label' => 'title', 'id' => 'id']
          ],
          'options' => [
            ['label' => 'Any', 'value' => 'any'],
          ],
          'props' => [
            'label' => 'Store'
          ],
        ],

      ],

      "settings" => [

        "email" => [

          "recipients" => [
            ['label' => 'Customer Email', 'value' => 'EMail']
          ]
        ],

        "sms" => [
          "recipients" => [
            ['label' => 'Day Phone', 'value' => 'DayPhone'],
            ['label' => 'Evening Phone', 'value' => 'EvePhone'],
            ['label' => 'Cell Phone', 'value' => 'CellPhone']
          ]
        ],

        "pusher" => [
          "recipients" => [
            ['label' => 'Rep 1', 'value' => 'repId'],
            ['label' => 'Rep 2', 'value' => 'repId2']
          ]
        ],

        "firebase" => [
          "recipients" => [
            ['label' => 'Rep 1', 'value' => 'repId'],
            ['label' => 'Rep 2', 'value' => 'repId2']
          ]
        ],
      ],
    ],
  ]
```

Provider Config Example [providers](Config/config.php)
------------------------------------------------------

[](#provider-config-example-providers)

```
 "pusher" => [// PUSHER PROVIDER
      "name" => "Pusher",
      "systemName" => "pusher",
      "icon" => "far fa-bell",
      "color" => "#c223ce",
      "rules" => [
        "numeric",
        "min:1",
      ],
      "fields" => [
        "id" => [
          'value' => null,
        ],
        "pusherAppEncrypted" => [
          "name" => "pusherAppEncrypted",
          'value' => true,
          'type' => 'toggle',
          "isFakeField" => 'fields',
          'props' => [
            'label' => 'Pusher App Encrypted',
            'falseValue' => false,
            'trueValue' => true
          ],
          "configRoute" => "broadcasting.connections.pusher.options.encrypted"
        ],

        "pusherAppId" => [
          "name" => "pusherAppId",
          'value' => '',
          'type' => 'input',
          "isFakeField" => 'fields',
          'required' => true,
          'props' => [
            'label' => 'Pusher App Id *'
          ],
          "configRoute" => "broadcasting.connections.pusher.app_id"
        ],

        "pusherAppKey" => [
          "name" => "pusherAppKey",
          'value' => '',
          'type' => 'input',
          "isFakeField" => 'fields',
          'required' => true,
          'props' => [
            'label' => 'Pusher App Key *'
          ],
          "configRoute" => "broadcasting.connections.pusher.key"
        ],

        "pusherAppSecret" => [
          "name" => "pusherAppSecret",
          'value' => '',
          'type' => 'input',
          "isFakeField" => 'fields',
          'required' => true,
          'props' => [
            'label' => 'Pusher App Secret *'
          ],
          "configRoute" => "broadcasting.connections.pusher.secret"
        ],

        "pusherAppCluster" => [
          "name" => "pusherAppCluster",
          'value' => '',
          'type' => 'input',
          "isFakeField" => 'fields',
          'required' => true,
          'props' => [
            'label' => 'Pusher App Cluster *'
          ],
          "configRoute" => "broadcasting.connections.pusher.options.cluster"
        ],
        "status" => [
          "name" => "status",
          'value' => '0',
          'type' => 'select',
          'required' => true,
          'props' => [
            'label' => 'Status',
            'options' => [
              ["label" => 'enabled', "value" => '1'],
              ["label" => 'disabled', "value" => '0'],
            ],
          ],
        ],
        "default" => [
          "name" => "default",
          'value' => false,
          'type' => 'checkbox',
          'props' => [
            'label' => 'Default',
          ]
        ],
        "saveInDatabase" => [
          "name" => "saveInDatabase",
          'value' => '1',
          'type' => 'select',
          'required' => true,
          'props' => [
            'label' => 'Save in database',
            'options' => [
              ["label" => 'enabled', "value" => '1'],
              ["label" => 'disabled', "value" => '0'],
            ],
          ],
        ],
        "type" => ['value' => 'broadcast'],
      ],
      "settings" => [
        "recipients" => [
          "name" => "recipients",
          'value' => '',
          'type' => 'input',
          "isFakeField" => 'settings',
          'props' => [
            'label' => 'Recipients',
            "hint" => "Enter recipient ID - separate entries with commas"
          ],
        ],
        "status" => [
          "name" => "status",
          'value' => '0',
          'type' => 'select',
          'required' => true,
          'props' => [
            'label' => 'Enable',
            'options' => [
              ["label" => 'enabled', "value" => '1'],
              ["label" => 'disabled', "value" => '0'],
            ],
          ],
        ],
        "saveInDatabase" => [
          "name" => "saveInDatabase",
          'value' => '1',
          'type' => 'select',
          'required' => true,
          'props' => [
            'label' => 'Save in database',
            'options' => [
              ["label" => 'enabled', "value" => '1'],
              ["label" => 'disabled', "value" => '0'],
            ],
          ],
        ],
      ]
    ],
```

Flow Chart
----------

[](#flow-chart)

[![Flow Chart](https://raw.githubusercontent.com/imagina/asgardcms-inotifications/dev-4.0/Assets/img/flow-chart.jpeg)](https://raw.githubusercontent.com/imagina/asgardcms-inotifications/dev-4.0/Assets/img/flow-chart.jpeg)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance50

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~137 days

Recently: every ~468 days

Total

19

Last Release

222d ago

Major Versions

v0.0.1.x-dev → 3.1.02019-09-02

3.1.4 → 4.0.02020-03-11

4.1.1 → 10.0.02024-06-11

10.0.0 → v12.x-dev2025-08-19

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

10.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bc4bd5d733cfbe7e145670fbb1539bdb8d33f43c2cca4f26a119d37dfbad62f?d=identicon)[imagina](/maintainers/imagina)

---

Top Contributors

[![JCEC007](https://avatars.githubusercontent.com/u/7571125?v=4)](https://github.com/JCEC007 "JCEC007 (52 commits)")[![imagina](https://avatars.githubusercontent.com/u/758247?v=4)](https://github.com/imagina "imagina (23 commits)")[![YeisonTapia](https://avatars.githubusercontent.com/u/10624544?v=4)](https://github.com/YeisonTapia "YeisonTapia (22 commits)")[![willvrd](https://avatars.githubusercontent.com/u/8865099?v=4)](https://github.com/willvrd "willvrd (18 commits)")[![CristianMarin19](https://avatars.githubusercontent.com/u/54483189?v=4)](https://github.com/CristianMarin19 "CristianMarin19 (18 commits)")[![msolanoimagina](https://avatars.githubusercontent.com/u/121646384?v=4)](https://github.com/msolanoimagina "msolanoimagina (14 commits)")[![ImaginaMarcsor](https://avatars.githubusercontent.com/u/39388591?v=4)](https://github.com/ImaginaMarcsor "ImaginaMarcsor (9 commits)")[![msolanogithub](https://avatars.githubusercontent.com/u/38920570?v=4)](https://github.com/msolanogithub "msolanogithub (8 commits)")[![slimarias](https://avatars.githubusercontent.com/u/5732644?v=4)](https://github.com/slimarias "slimarias (4 commits)")[![IMNicolasM](https://avatars.githubusercontent.com/u/143624699?v=4)](https://github.com/IMNicolasM "IMNicolasM (4 commits)")[![adrianacardoso](https://avatars.githubusercontent.com/u/39056746?v=4)](https://github.com/adrianacardoso "adrianacardoso (3 commits)")[![TJULIAN-D](https://avatars.githubusercontent.com/u/65859890?v=4)](https://github.com/TJULIAN-D "TJULIAN-D (2 commits)")[![josuebedoya](https://avatars.githubusercontent.com/u/145929750?v=4)](https://github.com/josuebedoya "josuebedoya (2 commits)")[![odchunzag](https://avatars.githubusercontent.com/u/43626463?v=4)](https://github.com/odchunzag "odchunzag (1 commits)")[![Nikos1010](https://avatars.githubusercontent.com/u/80610151?v=4)](https://github.com/Nikos1010 "Nikos1010 (1 commits)")

---

Tags

notificationspusherasgardcms

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/imagina-inotification/health.svg)

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

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[laravel-notification-channels/pusher-push-notifications

Pusher native Push Notifications driver.

282733.2k1](/packages/laravel-notification-channels-pusher-push-notifications)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[asgardcms/notification-module

Module handling the real time notifications

205.0k](/packages/asgardcms-notification-module)

PHPackages © 2026

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