PHPackages                             gaaarfild/laravel-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. gaaarfild/laravel-notifications

Abandoned → [garf/laravel-notifications](/?search=garf%2Flaravel-notifications)Library[Mail &amp; Notifications](/categories/mail)

gaaarfild/laravel-notifications
===============================

Convenient flash notifications

2.1.1(9y ago)213.5k6MITPHPPHP &gt;=5.4.0

Since Aug 27Pushed 9y ago3 watchersCompare

[ Source](https://github.com/garf/laravel-notifications)[ Packagist](https://packagist.org/packages/gaaarfild/laravel-notifications)[ RSS](/packages/gaaarfild-laravel-notifications/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (14)Used By (0)

Laravel Convenient System Notifications
=======================================

[](#laravel-convenient-system-notifications)

[![Laravel Version](https://camo.githubusercontent.com/2eeacc241c9b089e24b488130b631df795e13f9a52d0be8b41c62cd804376212/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d352e312d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](http://laravel.com)![Packagist](https://camo.githubusercontent.com/a38800631a6a394e638ef6982c75161766a43a0c95d775598a1692c871571b0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676172662f6c61726176656c2d6e6f74696669636174696f6e732e737667)[![Licence](https://camo.githubusercontent.com/c3aa6b987b672d97980832e75570da67d16ad96b587276b56d4c9162b2237dcb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f676172662f6c61726176656c2d6e6f74696669636174696f6e732e737667)](https://github.com/garf/laravel-notifications/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/5727630bfb269a0110f912e1e67b38d671b58c110da8f7f21d9eec6870b86c88/68747470733a2f2f7472617669732d63692e6f72672f676172662f6c61726176656c2d6e6f74696669636174696f6e732e737667)](https://travis-ci.org/garf/laravel-notifications)

[![Laravel Notifications](notifications.png)](notifications.png)

[Russian Documentation / Русская документация](https://github.com/garf/laravel-notifications/blob/master/README-ru.md)

Notification system for Laravel 5.

Often after saving some data from user you have to redirect to proper page and notificate user that everything done successfully or some errors appeared.

Now you can do this more convenient and easy way.

Install
-------

[](#install)

To install, execute the following command in the console:

```
$ composer require "garf/laravel-notifications:2.*"
```

When completed, add to your `config/app.php` file in the `providers` section

```
'providers' => [
    // ...
    Garf\LaravelNotifications\LaravelNotificationsServiceProvider::class,
]
```

If you want to use `Notifications` facade, add to same file at the `aliases` section

```
'aliases' => [
    // ...
  'Notifications' => Garf\LaravelNotifications\NotificationsFacade::class,
]
```

To change the templates, please execute the following command in the console:

`php artisan vendor:publish --provider="Garf\LaravelNotifications\LaravelNotificationsServiceProvider" --tag="config"`

Now you will be able to set any view file for notifications render in `config/laravel-notifications.php`.

Optionally you can execute the following command in the console to edit the default template, instead of using your own:

`php artisan vendor:publish --provider="Garf\LaravelNotifications\LaravelNotificationsServiceProvider" --tag="views"`

Note: If you publish the view and edit it, do not change the name of the view in the config file.

Usage
-----

[](#usage)

### Save messages for the next request

[](#save-messages-for-the-next-request)

```
Notifications::add('Your message text', 'type', 'group');
```

`$type` param used especially for Twitter Bootstrap render. It displays alerts with respective class.

i.e. If you set `type` to `danger`, alert with class 'alert alert-danger' will be generated on `toBootstrap()` format method.

`$group` param groups messages to groups. :) On the next Request you can retrieve them by group.

Also more convenient aliases can be used:

```
    Notifications::info('Your message text', 'group');
    Notifications::success('Your message text', 'group');
    Notifications::warning('Your message text', 'group');
    Notifications::danger('Your message text', 'group');
    Notifications::error('Your message text', 'group');
```

### Retrieving messages

[](#retrieving-messages)

#### All messages

[](#all-messages)

```
Notifications::all()->get();
```

#### Messages by group

[](#messages-by-group)

```
Notifications::byGroup('my-group')->get();
```

#### Messages by type

[](#messages-by-type)

```
Notifications::byType('warning')->get();
```

### Format messages

[](#format-messages)

You also can format messages

#### JSON

[](#json)

You can retrieve and format all messages as JSON

```
Notifications::all()->toJson();
```

Or can filter them by group or type

```
Notifications::byType('success')->toJson();

Notifications::byGroup('login')->toJson();
```

#### Render with blade view files

[](#render-with-blade-view-files)

You can also render your notifications with custom view files

```
{{ Notifications::all() }}
```

And you can filter them by group or type as well:

```
{{ Notifications::byType('info') }}

{{ Notifications::byGroup('registration') }}
```

by default method uses Twitter Bootstrap alerts format.

[Twitter Bootstrap](http://getbootstrap.com) can be required.

### Other

[](#other)

#### Count Messages

[](#count-messages)

```
Notifications::all()->count();
```

#### Check if messages exist

[](#check-if-messages-exist)

```
Notifications::all()->has();
```

#### Get First Message

[](#get-first-message)

```
Notifications::all()->first();
```

#### Form Request usage

[](#form-request-usage)

If you want to display errors via Laravel Form Request, you have to override method `formatErrors()` in your Form Request Class.

```
    public function formatErrors(Validator $validator){
        foreach ($validator->errors()->all() as $error) {
            Notifications::add($error, 'danger');
        }

        return $validator->errors()->getMessages();
    }
```

Don't forget to import `Validator` class in head of the file:

`use Illuminate\Contracts\Validation\Validator;`

Contributions
-------------

[](#contributions)

Contributions are highly appreciated.

Send your pull requests to `master` branch.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/garf/laravel-notifications/blob/master/LICENSE) for more information.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 84.3% 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 ~43 days

Recently: every ~57 days

Total

13

Last Release

3394d ago

Major Versions

v1.2.5 → v2.0.02016-07-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/29cdfd289f56bbc3b1cc8b5cf600e271da8953dc86358adb3ae6236eb8becd69?d=identicon)[garf](/maintainers/garf)

---

Top Contributors

[![garf](https://avatars.githubusercontent.com/u/1891709?v=4)](https://github.com/garf "garf (43 commits)")[![mikemand](https://avatars.githubusercontent.com/u/745184?v=4)](https://github.com/mikemand "mikemand (6 commits)")[![18601673727](https://avatars.githubusercontent.com/u/3302620?v=4)](https://github.com/18601673727 "18601673727 (1 commits)")[![Big-Shark](https://avatars.githubusercontent.com/u/646054?v=4)](https://github.com/Big-Shark "Big-Shark (1 commits)")

---

Tags

laravelnotificationsalert

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gaaarfild-laravel-notifications/health.svg)

```
[![Health](https://phpackages.com/badges/gaaarfild-laravel-notifications/health.svg)](https://phpackages.com/packages/gaaarfild-laravel-notifications)
```

###  Alternatives

[edvinaskrucas/notification

Package for Laravel for helping to manage flash / instant notifications / messages.

520393.9k10](/packages/edvinaskrucas-notification)[sarfraznawaz2005/laravel-sse

Laravel package to provide Server Sent Events functionality for your app.

474.6k](/packages/sarfraznawaz2005-laravel-sse)[usamamuneerchaudhary/filament-notifier

A powerful notification system for FilamentPHP that handles multi-channel notifications with template management, scheduling, and real-time delivery. Built for developers who need enterprise-grade notifications without the complexity.

321.1k](/packages/usamamuneerchaudhary-filament-notifier)

PHPackages © 2026

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