PHPackages                             jorgejavierleon/laravelpnotify - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jorgejavierleon/laravelpnotify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jorgejavierleon/laravelpnotify
==============================

Laravel 5 implementation for flash messages with Pnotify

1.0(10y ago)1117.3k↑17.8%2[4 issues](https://github.com/jorgejavierleon/LaravelPnotify/issues)1PHP

Since Sep 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/jorgejavierleon/LaravelPnotify)[ Packagist](https://packagist.org/packages/jorgejavierleon/laravelpnotify)[ RSS](/packages/jorgejavierleon-laravelpnotify/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (2)Used By (1)

Notifications message for laravel 5 with Pnotify
================================================

[](#notifications-message-for-laravel-5-with-pnotify)

[![Build Status](https://camo.githubusercontent.com/41d087e2d3fcaaaf99142f6e709bf19f9baf1d9872122619dbaa8da36f0f4599/68747470733a2f2f7472617669732d63692e6f72672f6a6f7267656a61766965726c656f6e2f4c61726176656c506e6f746966792e7376673f6272616e63683d312e30)](https://travis-ci.org/jorgejavierleon/LaravelPnotify)[![Latest Stable Version](https://camo.githubusercontent.com/5274999128b63eec9b8205d3f2bdfd6460c6662d537161b255451bc0fb4845eb/68747470733a2f2f706f7365722e707567782e6f72672f6a6f7267656a61766965726c656f6e2f6c61726176656c706e6f746966792f762f737461626c65)](https://packagist.org/packages/jorgejavierleon/laravelpnotify)[![Total Downloads](https://camo.githubusercontent.com/f2519de2d33fa8b82c0ca5749ac1bdb807c4a6c40de09593bbb81325a02db3e1/68747470733a2f2f706f7365722e707567782e6f72672f6a6f7267656a61766965726c656f6e2f6c61726176656c706e6f746966792f646f776e6c6f616473)](https://packagist.org/packages/jorgejavierleon/laravelpnotify)

This package give you a Laravel 5 implementation for flash messages or notifications with [Pnotify](http://sciactive.github.io/pnotify/) javascript library.

Within your controllers you can use the Facade and get the flash message in the next request:

```
public function store()
{
    $user->save();

    Notify::success('The user has been created');

    return view('home')

}
```

Installation
------------

[](#installation)

Begin by installing this package through Composer.

```
{
    "require": {
        "jorgejavierleon/laravelpnotify": "~1.0"
    }
}
```

Include the service provider within config/app.php.

```
// app/config/app.php

'providers' => [
    ...,
    Jleon\LaravelPnotify\NotifyServiceProvider::class,
];
```

If you want to use the facade, add the alias to the aliases array at the bottom of config/app.php:

```
// app/config/app.php

'aliases' => [
    ...,
    'Notify' => Jleon\LaravelPnotify\Notify::class,
];
```

#### Pnotify

[](#pnotify)

You'll need to include the Pnotify files in your views. jQuery is also require. For the complete guide refer to the [documentation](https://github.com/sciactive/pnotify).

A typical instalation, with [Bootstrap](http://getbootstrap.com/) styling and the buttons component, will include the following

```
    {{--Bootstrap--}}

    {{--Pnotify--}}

    {{--jQuey--}}

    {{--Bootstrap--}}

    {{--Pnotify--}}

```

> Bootstrap is not require but is the default style of the package. You can change this in the configurations.

#### View

[](#view)

Finally, you'll need to use the view that come with this package, or create one for yourself, to display the notifications.

To use the view that comes by default, include `laravelPnotify::notify` after the Pnotify js files

```
    {{--Pnotify--}}

    @include('laravelPnotify::notify')
```

The view included is very simple, it just check the session and build the Pnotify object

```
    @if (Session::has('notifier.notice'))

            new PNotify({!! Session::get('notifier.notice') !!});

    @endif
```

Usage
-----

[](#usage)

#### Basic notices

[](#basic-notices)

You'll get the customary notification methods:

- `Notify::success('require body', 'optional title')`
- `Notify::info('require body', 'optional title')`
- `Notify::warning('require body', 'optional title')`
- `Notify::error('require body', 'optional title')`

> If you don't include a title, the body of the notice will be formatted as a title to enhance visibility

#### Sticky notices

[](#sticky-notices)

By default this notifications will fadeout in 8 seconds, but you can persist the notification by chaining a sticky method

`Notify::info('This notice won't fadeout')->sticky()`

Customize
---------

[](#customize)

You can customize any configurations for the basic notice module. To customize the defaults you can publish the config file by running

```
    php artisan vendor:publish
```

Or just create your own config file `config/laravelPnotify` and override only the ones you need

```
    //config/laravelPnotify
