lloople / laravel-notificator
Attach objects to notification's session flashed variable
Installs: 149
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/lloople/laravel-notificator
Requires
- php: >=7.1
- laravel/framework: 5.5.* || 5.6.*
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2025-10-24 06:33:53 UTC
README
Simple session flashing messages manager for Laravel
Notifications are stored in Laravel's session flash input, keyed by notifications
Create a notification
Notificator::success('This is a success notification');
You can choose between 4 types
successinfoerrorwarning
Print a notification
@foreach(Notificator::all() as $notification) <div class="alert alert-{{ $notification->getBootstrapClass() }}> <p>{{ $notification->getMessage() }}</p> </div> @endforeach
getBootstrapType() transforms the error type into danger to use it with Bootstrap default CSS alerts.
If you're not using Bootstrap, you can use getType to get it as error.
If you just want the first notification or you know you'll work with just one, you can use
Notificator::first()->getMessage();
Duration
Notification's Messages also have an integer $duration in case you use a javscript library like toastr.js
You can modify the default duration of 5 seconds when creating the notification
Notificator::success('Message', 10000); // 10 seconds