Laravel adapter for PHPFlasher Toastr. Seamlessly integrate Toastr notifications into Laravel applications.
- PHP >= 8.2
- Laravel >= 11.0
- php-flasher/flasher-laravel ^2.4.0
- php-flasher/flasher-toastr ^2.4.0
composer require php-flasher/flasher-toastr-laravel// Global helper
toastr()->success('Operation completed successfully!');
toastr()->error('An error occurred.');
toastr()->info('Information message.');
toastr()->warning('Warning message.');
// In controller
public function save(Request $request)
{
// Your logic...
toastr()->success('Changes saved!');
return redirect()->back();
}
// With options
toastr()->success('Success message', [
'timeOut' => 5000,
'positionClass' => 'toast-top-right',
]);- Laravel Facade:
toastr()global helper - Dependency Injection:
ToastrFactorytype-hinted injection - Laravel Integration: Auto-injects assets in Blade templates
- Flash Bag: Converts Laravel flash messages to Toastr notifications
Publish configuration:
php artisan flasher:install --configAdd to config/flasher.php:
return [
'plugins' => [
'toastr' => [
'options' => [
'timeOut' => 5000,
'progressBar' => true,
'positionClass' => 'toast-top-right',
],
],
],
];Complete documentation: php-flasher.io