laravel-notify maintained by samaun
Samaun Notify
A modern, customizable toast notification package for Laravel 10–13.
Installation
composer require samaun/laravel-notify
php artisan vendor:publish --tag=notify-config
php artisan vendor:publish --tag=notify-assets
Add to your main Blade layout:
<head>
@notifyCss
</head>
<body>
@yield('content')
@notify
@notifyJs
</body>
Laravel usage
notify()->success('Profile updated successfully!');
notify()->error('Something went wrong.');
notify()->warning('Please check the submitted information.');
notify()->info('You have a new notification.');
notify()->success('Saved!', [
'title' => 'Great work',
'duration' => 6000,
'position' => 'bottom-right',
'theme' => 'dark',
]);
Custom type
// config/notify.php
'types' => [
'success' => ['accent' => '#16a34a', 'icon' => '✓'],
'premium' => ['accent' => '#8b5cf6', 'icon' => '✦'],
];
// Usage
notify()->custom('premium', 'Welcome to the premium plan!', [
'title' => 'Subscription active',
'duration' => 7000,
]);
JavaScript usage
SamaunNotify.success('Saved successfully!');
SamaunNotify.error('Request failed', { title: 'Error', duration: 7000 });
SamaunNotify.loading('Uploading your file...');
SamaunNotify.custom('premium', 'A custom toast', {
accent: '#8b5cf6',
icon: '✦',
position: 'bottom-left'
});
SamaunNotify.clear();
Livewire
Include @notifyJs in the layout. From a Livewire component:
$this->dispatch('samaun-notify', toast: [
'type' => 'success',
'message' => 'Your profile was updated!',
'title' => 'Success',
'duration' => 5000,
]);
Options
title, duration (0 = persistent), position (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right), theme (light, dark), accent, icon, dismissible, progress, progressBar, pauseOnHover, action (label, onClick, dismiss).
Development
This is an initial package scaffold. Run composer validate and add PHPUnit/Orchestra Testbench coverage before publishing to Packagist.