There is no license information available for the latest version (2.0.0) of this package.

A site notification package for laravel.

Installs: 1 427

Dependents: 1

Suggesters: 1

Stars: 9

Watchers: 3

Forks: 2

Open Issues: 0

2.0.0 2015-08-27 10:03 UTC


A site notification package for laravel.

Currently let's you easily flash notifications to the session. It also supports laravels translation package out of the box.

Table of Contents


You can install the package for your Laravel 4 project through Composer.

Require the package in your composer.json.

"andheiberg/notify": "2.*"

Run composer to install or update the package.

$ composer update

Register the service provider in app/config/app.php.


Add the alias to the list of aliases in app/config/app.php.

'Notify' => 'Andheiberg\Notify\Facades\Notify',


The packages provides you with some configuration options.

To create the configuration file run this command in your command line app:

$ php artisan config:publish andheiberg/notify

The configuration file will be published here: app/config/packages/andheiberg/notify/config.php.


Adding Notifications

By default, the package has some notification types defined in its configuration file. The default types are success, error, warning and info.

Every type can be called as a function.

Notify::info('This is an info message.');
Notify::error('Whoops, something has gone wrong.');

You can of course add your own types by adding them to your own config file. See above on how to publish the config file.

You can also pass a language tag for easy localization.

Notify::success('auth.login-successful'); // Calls Lang::get('auth.login-successful') behind the scene
Notify::warning('auth.verification-email-sent', ['email' => '']) // You can also pass replacements

Displaying Notifications

Notify class is just an extension of Illuminate's MessageBag class, which means we can use all of its functionality to display messages.

@foreach (Notify::all() as $notification)
    {{ $notification }}

Or if you'd like to display a single notification for a certain level.

@if (Notify::has('success'))
    {{ Notify::first('success') }}

If you'd like to learn more ways on how you can display messages, please take a closer look to Illuminate's MessageBag class.

Bootstrap example
@if (Notify::all())
    <div class="container">
        @foreach (Notify::get('success') as $alert)
            <div class="alert alert-success">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ $alert }}

        @foreach (Notify::get('error') as $alert)
            <div class="alert alert-danger">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ $alert }}

        @foreach (Notify::get('info') as $alert)
            <div class="alert alert-info">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ $alert }}

        @foreach (Notify::get('warning') as $alert)
            <div class="alert alert-warning">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ $alert }}