PHPackages                             gloudemans/notify - 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. gloudemans/notify

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

gloudemans/notify
=================

Laravel Notifications

1.0.0(10y ago)1811.5k5MITPHPPHP &gt;=5.5.0

Since Aug 22Pushed 10y ago2 watchersCompare

[ Source](https://github.com/Crinsane/LaravelNotify)[ Packagist](https://packagist.org/packages/gloudemans/notify)[ RSS](/packages/gloudemans-notify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Notify
==============

[](#laravel-notify)

[![Build Status](https://camo.githubusercontent.com/19be18c573ccf1a409ae43bd144dca6ecf2f0fb3dc68e1dd9358fae7c348320b/68747470733a2f2f7472617669732d63692e6f72672f4372696e73616e652f4c61726176656c4e6f746966792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Crinsane/LaravelNotify)[![Total Downloads](https://camo.githubusercontent.com/5e3a81381c7cd19c9dad4f6d086624fd384e2603601d8e027d62473609eeff31/68747470733a2f2f706f7365722e707567782e6f72672f676c6f7564656d616e732f6e6f746966792f646f776e6c6f616473)](https://packagist.org/packages/gloudemans/notify)[![License](https://camo.githubusercontent.com/7dc86d0ebd8fbe753bd0f51b6799519f5e6ec9fbff957692aa3d218a450209f7/68747470733a2f2f706f7365722e707567782e6f72672f676c6f7564656d616e732f6e6f746966792f6c6963656e7365)](https://packagist.org/packages/gloudemans/notify)

Some helpful tools for getting handy flash notifications on your website Out of the box support for: Toastr, SweetAlert, Bootbox and native notifications!

Installation
============

[](#installation)

Install the package through [Composer](http://getcomposer.org/). Require this package with Composer using the following command:

```
composer require gloudemans/notify

```

Next you need to register the package in Laravel by adding the service provider. To do this open your `config/app.php` file and add a new line to the `providers` array:

```
Gloudemans\Notify\LaravelNotifyServiceProvider::class,

```

Now that the package has been registered you can copy the package config file to your local config with the following command:

```
artisan vendor:publish --provider="Gloudemans\Notify\LaravelNotifyServiceProvider" --tag="config"

```

Now your all set to use the notification package in your Laravel application.

### Optional

[](#optional)

If you'd like to use the `Notification` facade, add a new line to the `aliases` array:

```
'Notification' => Gloudemans\Notify\Notifications\NotificationFacade::class,

```

Usage
=====

[](#usage)

Using this package is actually pretty easy. Adding notifications to your application actually only requires two steps.

Adding a notification
---------------------

[](#adding-a-notification)

First, of course, you need a way to flash the notification to session so they are available on the next request. If you've injected the `Gloudemans\Notify\Notifications\Notification` class into, for instance, your controller, flashing the notification to the session is as easy as this:

```
$this->notification->add('success', 'Notification message', 'Notification title');

```

And if you're using the facade it's as easy as:

```
Notification::add('success', 'Notification message', 'Notification title');

```

- The first parameter is the type of notification, the package understand four types of notification: `success`, `info`, `warning` and `error`.
- The second parameter is the message of the notification.
- The third *(optional)* parameter is the title of the notification.

To make life even easier there are also four helper methods for different types of notification. So instead of manually supplying the notification type you can simply call a method with the type as its name:

```
    $this->notification->success('Success notification');
    $this->notification->info('Info notification');
    $this->notification->warning('Warning notification');
    $this->notification->error('Error notification');
```

Finally you can also add the `Gloudemans\Notify\Notifications\AddsNotifications` trait to your class, which will supply you methods for adding the notifications:

```
    use AddsNotifications;

    public function yourMethod()
    {
        $this->notify()->success(...); // Also info(), warning(), error()
        $this->notifySuccess(...);
        $this->notifyInfo(...);
        $this->notifyWarning(...);
        $this->notifyError(...);
    }
```

Displaying the notifications
----------------------------

[](#displaying-the-notifications)

The second step is to actually show the notifications on your website. All notifications can be rendered using the `render()` method on `Gloudemans\Notify\Notifications\Notification`.

So a possibility is to add something like this to one of your views:

```

```

But if you're like me and don't like code like this in your view there's a nice little Blade directive available:

```
@notifications

```

Adding this Blade directive to one of your views give the package a place to render the JavaScript output for rendering the notifications.

*The recommended location for rendering the notifications is at the bottom of your 'master' layout file*

Renderers
---------

[](#renderers)

The packages uses dedicated 'renderer' classes for rendering the notifications. Out of the box you can choose between: `native` (default), `toastr`, `sweetalert` and `bootbox`. To change the renderer that the package uses, simply update the value of `notifications` in the `notifications.php` config file.

The native renderer is the only renderer that doesn't require any extra JavaScript libraries as it uses simple `alert()` functions for showing the notification.

For all the other renderers the necessary scripts and stylesheets are bundled with the package and can be copied to your public directory with the following command:

```
artisan vendor:publish --provider="Gloudemans\Notify\LaravelNotifyServiceProvider" --tag="assets"

```

But of course you're free to download them manually or pull them in with another service and include them in your asset build sequence.

*Make sure the scripts are added BEFORE you call the `render()` method*

Extending
=========

[](#extending)

If you want to use another library for notifications in your project, that's totally possible! What you need to do is create your own renderer and change a binding in the service container of Laravel.

Your custom renderer must implement the `Gloudemans\Notify\Notifications\NotificationRenderer` interface, which forces you to implement one simple method:

```
    /**
     * Render the notifications as HTML/JavaScript
     *
     * @param  array $notifications
     * @return string
     */
    public function render(array $notifications);
```

Once you've created your custom renderer you can bind it to the interface like this:

```
    $this->app->bind(
        'Gloudemans\Notify\Notifications\NotificationRenderer',
        'App\Renderers\MyCustomRenderer'
    );
```

And that's all you need to do to extend the package with your custom renderer.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3922d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f64450ce9237ee1d14d63ba276d0a60e1fd1f3031f39f865bd6f5a0d141b48c?d=identicon)[Crinsane](/maintainers/Crinsane)

---

Top Contributors

[![Crinsane](https://avatars.githubusercontent.com/u/1297781?v=4)](https://github.com/Crinsane "Crinsane (8 commits)")

---

Tags

laravelnotificationsnotifyflashnotifictions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gloudemans-notify/health.svg)

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

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[edvinaskrucas/notification

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

520393.9k10](/packages/edvinaskrucas-notification)[brian2694/laravel-toastr

toastr.js for Laravel

136649.4k5](/packages/brian2694-laravel-toastr)[helmesvs/laravel-notify

Elegant notifications to laravel with Toastr or PNotify

6127.3k](/packages/helmesvs-laravel-notify)[bpocallaghan/notify

Laravel 5 Flash Notifications with icons and animations and with a timeout

3416.6k3](/packages/bpocallaghan-notify)[arcanedev/notify

Flexible flash notifications helper for Laravel.

139.5k1](/packages/arcanedev-notify)

PHPackages © 2026

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