2017 © Pedro Peláez
 

library notify

A site notification package for laravel.

image

andheiberg/notify

A site notification package for laravel.

  • Tuesday, June 28, 2016
  • by AndreasHeiberg
  • Repository
  • 3 Watchers
  • 12 Stars
  • 5,304 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 4 Forks
  • 0 Open issues
  • 7 Versions
  • 7 % Grown

The README.md

Notify

A site notification package for laravel., (*1)

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

Table of Contents

Installation

You can install the package for your Laravel project through Composer., (*3)

# Laravel 4x
composer require andheiberg/notify:1.*

# Laravel 5x
composer require andheiberg/notify:2.*

Register the service provider in app/config/app.php., (*4)

Andheiberg\Notify\NotifyServiceProvider::class,

Add the alias to the list of aliases in app/config/app.php., (*5)

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

Configuration

The packages provides you with some configuration options., (*6)

To create the configuration file run this command in your command line app:, (*7)

# Laravel 4x
php artisan config:publish andheiberg/notify

# Laravel 5x
php artisan vendor:publish --provider="Andheiberg\Notify\NotifyServiceProvider"

The configuration file will be published here: app/config/packages/andheiberg/notify/config.php., (*8)

Usage

Adding Notifications

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

Every type can be called as a function., (*10)

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., (*11)

You can also pass a language tag for easy localization., (*12)

Notify::success('auth.login-successful'); // Calls Lang::get('auth.login-successful') behind the scene
Notify::warning('auth.verification-email-sent', ['email' => 'test@gmail.com']) // 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., (*13)

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

Or if you'd like to display a single notification for a certain level., (*14)

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

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

Bootstrap example

@if (Notify::all())


@foreach (Notify::get('success') as $alert)
{{ $alert }}
@endforeach @foreach (Notify::get('error') as $alert)
{{ $alert }}
@endforeach @foreach (Notify::get('info') as $alert)
{{ $alert }}
@endforeach @foreach (Notify::get('warning') as $alert)
{{ $alert }}
@endforeach
@endif

The Versions

28/06 2016

dev-master

9999999-dev

A site notification package for laravel.

  Sources   Download

The Requires

 

The Development Requires

by Andreas Peter Heiberg

27/08 2015

2.0.x-dev

2.0.9999999.9999999-dev

A site notification package for laravel.

  Sources   Download

The Requires

 

The Development Requires

by Andreas Peter Heiberg

27/08 2015

2.0.0

2.0.0.0

A site notification package for laravel.

  Sources   Download

The Requires

 

The Development Requires

by Andreas Peter Heiberg

12/01 2015

1.0.x-dev

1.0.9999999.9999999-dev

A site notification package for laravel.

  Sources   Download

The Requires

 

The Development Requires

by Andreas Peter Heiberg

12/01 2015

1.0.2

1.0.2.0

A site notification package for laravel.

  Sources   Download

The Requires

 

The Development Requires

by Andreas Peter Heiberg

23/03 2014

1.0.1

1.0.1.0

A site notification package for laravel.

  Sources   Download

The Requires

 

The Development Requires

23/03 2014

1.0.0

1.0.0.0

A highly extendable notification system with laravel integration.

  Sources   Download

The Requires

 

The Development Requires