Download the PHP package jorgejavierleon/laravelpnotify without Composer
On this page you can find all versions of the php package jorgejavierleon/laravelpnotify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravelpnotify
Notifications message for laravel 5 with Pnotify
This package give you a Laravel 5 implementation for flash messages or notifications with Pnotify javascript library.
Within your controllers you can use the Facade and get the flash message in the next request:
Installation
Begin by installing this package through Composer.
Include the service provider within config/app.php.
If you want to use the facade, add the alias to the aliases array at the bottom of config/app.php:
Pnotify
You'll need to include the Pnotify files in your views. jQuery is also require. For the complete guide refer to the documentation.
A typical instalation, with Bootstrap styling and the buttons component, will include the following
Bootstrap is not require but is the default style of the package. You can change this in the configurations.
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
The view included is very simple, it just check the session and build the Pnotify object
Usage
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
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
You can customize any configurations for the basic notice module. To customize the defaults you can publish the config file by running
Or just create your own config file config/laravelPnotify
and override only the ones you need
Override
If you need to override some defaults only for the next notice, use the override method and pass it an array of options
Testing
For those of you who are doing aceptance testing and don't want to mock the notifier class, I put together a trait with some
helper methods for testing the notifications messages in the larvel session. When using the trait you will be able to run assertions
like $this->seeNotificationType('success')
or $this->dontSeeNotification()
.
To get the trait go to my gist page, copy it to you helpers test folder and use like any other trait