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

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

matviib/notifier
================

NO LIBRARIES socket per page bridge for your Laravel application.

v1.3.1(7y ago)621.2k7MITPHP

Since Jan 25Pushed 7y ago6 watchersCompare

[ Source](https://github.com/MatviiB/notifier)[ Packagist](https://packagist.org/packages/matviib/notifier)[ Docs](https://matviib.com/notifier)[ RSS](/packages/matviib-notifier/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (0)

 [![build passed](https://camo.githubusercontent.com/3e2fc4add2afe01bf09a9e9ec30f6701467a0aa756fa7ed36804ada64e624d62/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174766969422f6e6f7469666965722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://camo.githubusercontent.com/3e2fc4add2afe01bf09a9e9ec30f6701467a0aa756fa7ed36804ada64e624d62/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174766969422f6e6f7469666965722f6261646765732f6275696c642e706e673f623d6d6173746572) [![code-intelligence](https://camo.githubusercontent.com/cfcf11444ec0573a0788014a0db35c194bd0fc510013e8b343aab9a767c5e751/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174766969422f6e6f7469666965722f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://camo.githubusercontent.com/cfcf11444ec0573a0788014a0db35c194bd0fc510013e8b343aab9a767c5e751/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d6174766969422f6e6f7469666965722f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572) [![license](https://camo.githubusercontent.com/0531f9d4df34030e68789812d5366bd7feaee0ef8aeae0a29a2efe65aa9cd9f6/68747470733a2f2f706f7365722e707567782e6f72672f6d6174766969622f6e6f7469666965722f6c6963656e7365)](https://camo.githubusercontent.com/0531f9d4df34030e68789812d5366bd7feaee0ef8aeae0a29a2efe65aa9cd9f6/68747470733a2f2f706f7365722e707567782e6f72672f6d6174766969622f6e6f7469666965722f6c6963656e7365) [![downloads](https://camo.githubusercontent.com/9e170536f0353d3cba69fb01fa74a1c7da5dc02a7a90c83f7ef40580ac20cac1/68747470733a2f2f706f7365722e707567782e6f72672f6d6174766969622f6e6f7469666965722f646f776e6c6f616473)](https://camo.githubusercontent.com/9e170536f0353d3cba69fb01fa74a1c7da5dc02a7a90c83f7ef40580ac20cac1/68747470733a2f2f706f7365722e707567782e6f72672f6d6174766969622f6e6f7469666965722f646f776e6c6f616473)

### Base concepts

[](#base-concepts)

You don't need socket.io, pusher.js, jQuery, bootstrap, node.js, vue.js to start using this package.

This package can be used for sending data synchronously to each user.

This package sends data ONLY to named routes declared as `GET`.

You will get your own socket server on back-end and your clients will connect to it directly, without any third-party requests to be send.

You will have pretty notifications from scratch.

To view available routes you can run `php artisan notifier:init show` command. It will display available routes in the table and initiate the socket server.

CodeDescription`event(new Notify($data));`- send to all routes.`event(new Notify($data, $routes));`- send to routes in `$routes` array.`event(new Notify($data, $routes, $users));`- send to routes in `$routes` and only to users in `$users`.### Installation

[](#installation)

```
composer require matviib/notifier

```

For Laravel &lt; 5.5 add provider to config/app.php

```
MatviiB\Notifier\NotifierServiceProvider::class,
```

For publish notifier config file and js file for notifications out of the box:

```
php artisan vendor:publish
```

and choose "Provider: MatviiB\\Notifier\\NotifierServiceProvider" if requested.

### Starting server

[](#starting-server)

Add worker daemon for `php artisan notifier:init` process with Supervisor,

OR

Just run `php artisan notifier:init` in terminal.

If you use SSL you need add to your `nginx` configuration file to server block:

```
    location /websocket {
        proxy_pass http://:; #server host and port
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";

        # Timeout configuration.
        proxy_redirect off;
        proxy_connect_timeout  300;
        proxy_send_timeout     300;
        proxy_read_timeout     300;
   }

```

### Usage

[](#usage)

At first you need to add `@include('notifier::connect')` before using `socket.addEventListener()` in your view or main layout to use it on ALL pages.

If you want use notifications from the scratch you need to add `@include('notifier::connect_and_show')` to the view.

Anywhere in your back-end add next event:

`event(new Notify($data));`

On front-end part add event listener

```

    socket.addEventListener('message', function (event) {
        console.log('Message from server', event.data);
    });

```

### Use built-in notifications.

[](#use-built-in-notifications)

Built-in notifications is a vue.js with [vue-notifications](https://github.com/euvl/vue-notification) plugin. If you already use vue.js in application you can just add this plugin yourself.

##### Mapping `$data` parameter.

[](#mapping-data-parameter)

ParameterDescription`'note' => 1,`- use notes `true``'type' =&gt; 'warnsuccess`'title' => 'TEXT'`- title of the note`'text' => 'Lorem ipsum'`- note's body##### Positioning.

[](#positioning)

In `config/notifier.php` you can modify position where notifications will be shown.

```
// Horizontal options: left, center, right
// Vertical options: top, bottom
'position' => [
        'vertical' => 'bottom',
        'horizontal' => 'right'
    ]

```

Security
--------

[](#security)

This package allows one way messages - only from server to client.

All messages from client after connecting will be ignored.

From server side messages protected with socket\_pass parameter from notifier config.

Channels to users protected with unique hash.

Example with charts
-------------------

[](#example-with-charts)

After installation add to web.php

```
Route::get('chart', function () {
    return view('chart');
})->name('chart');

```

create view `/resources/views/chart.blade.php`

```

    Chart

@include('notifier::connect')

    var data = [12, 19, 3, 17, 6, 3, 7, 45, 60, 25];

    var myChart = new Chart(document.getElementById('myChart'), {
        type: 'line',
        data: {
            labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
            datasets: [{
                label: 'example',
                data: data
            }]
        }
    });

    socket.addEventListener('message', function (event) {
        myChart.data.datasets[0].data.splice(0, 1);
        myChart.data.datasets[0].data.push(JSON.parse(event.data).data.value);
        myChart.update();
    });

```

In .env fix your APP\_URL `APP_URL=http://`

Create test command `php artisan make:command Test`

```
use MatviiB\Notifier\Events\Notify;

...

protected $signature = 'test';

public function handle()
    {
        while ($i < 100) {
            $value = random_int(10, 100);
            $data['value'] = $value;
            event(new Notify($data, ['chart']));
            usleep(rand(100000, 500000));
        }
}

```

Run: `php artisan notifier:init`

Run in another shell: `php artisan test`

Open `/chart` page.

### Usage Example

[](#usage-example)

Send new values to chart on some page synchronously to each user:

`event(new Notify($data, ['chart']));`

Or to users with `id` 3 and 5: `event(new Notify($data, ['chart'], [3, 5]));`

[![laravel socket server](https://camo.githubusercontent.com/016868c2410022c57a794fd50ac81dd1345f64645fc19295901b3fb765776a6e/68747470733a2f2f6769746c61622e636f6d2f4d6174766969422f6173736574732f7261772f6d61737465722f657a6769662e636f6d2d766964656f2d746f2d6769662e676966)](https://camo.githubusercontent.com/016868c2410022c57a794fd50ac81dd1345f64645fc19295901b3fb765776a6e/68747470733a2f2f6769746c61622e636f6d2f4d6174766969422f6173736574732f7261772f6d61737465722f657a6769662e636f6d2d766964656f2d746f2d6769662e676966)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~20 days

Total

10

Last Release

2851d ago

Major Versions

v0.0.4.1 → v1.0.02018-04-18

### Community

Maintainers

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

---

Top Contributors

[![MatviiB](https://avatars.githubusercontent.com/u/16453002?v=4)](https://github.com/MatviiB "MatviiB (75 commits)")

---

Tags

composer-librarycomposer-packagelaravellaravel-5laravel-5-packagelaravel-applicationlaravel5laravel55notificationsnotifierreal-timesocketsocket-clientsocket-communicationsocket-programmingsocket-serversocketssockets-easysocketserversocketstreamlaravelsocketsnotifiernotificationsreal-timeSocketlaravel 5laravel5composer-packagesocket-clientlaravel applicationlaravel-5-packagesocket-serverlaravel55socket-communicationcomposer-librarysocketserversocket-programmingsockets-easysocketstream

### Embed Badge

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

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

###  Alternatives

[liran-co/laravel-notification-subscriptions

Notification subscription management.

128239.2k1](/packages/liran-co-laravel-notification-subscriptions)[coreproc/nova-notification-feed

A Laravel Nova package that adds a notification feed in your Nova app.

10149.1k](/packages/coreproc-nova-notification-feed)[misma/laravel-mailpeek

MailPeek provides a simple local inbox right in your browser to enable you preview emails being sent from your application.

212.1k](/packages/misma-laravel-mailpeek)

PHPackages © 2026

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