devrabiul/laravel-toaster-magic
Dependency-free toast notifications for Laravel with Livewire v3/v4 support. Drop-in, customizable toasts with multiple modern themes, RTL + dark mode, XSS-safe links, and no need for jQuery, Bootstrap, or Tailwind.
glassmorphism, neon) and dark mode support enable rapid UI consistency across projects, reducing frontend customization effort.ToastMagic::success()).$this->dispatch('toastMagic', ...)) eliminates the need for manual JavaScript-Livewire synchronization.MessageBag handling (e.g., ToastMagic::error($validator->errors())) simplifies error feedback in forms, reducing custom validation UI code.e($userInput)). The package mitigates this with URL sanitization but requires developer discipline for dynamic content.'livewire_version' => 'v3') may cause issues if the project upgrades/downgrades Livewire without updating the package config.session()->flash() rely on JavaScript initialization, which could fail if scripts load after the toast container (mitigated by ToastMagic::scripts() placement).preventDuplicates feature may need tuning to avoid memory leaks.composer require devrabiul/laravel-toaster-magic
php artisan vendor:publish --provider="Devrabiul\ToastMagic\ToastMagicServiceProvider"
ToastMagic::success() and test.config/laravel-toaster-magic.php and migrate event-based toasts:
$this->dispatch('toastMagic', status: 'success', title: 'Updated', message: 'Data saved.');
glassmorphism) and test dark mode (<body theme="dark">).ToastMagic::error($validator->errors()).composer.json).v3 or v4) required in config.ToastMagic::styles()/scripts() to layout.session()->flash() toasts with ToastMagic::success() calls.dispatch('toastMagic', ...).ToastMagic::error($validator->errors()).preventDuplicates).timeOut, theme) are centralized in config/laravel-toaster-magic.php.timeOut: 10000) allow granular control.e($userInput)).ToastMagic::scripts() placement).livewire_version config).ToastMagic runs after session middleware).preventDuplicates mitigates memory leaks from rapid toasts.timeOut) prevent UI clutter.preventDuplicates or queue management).| Scenario | Impact | Mitigation |
|---|---|---|
| JavaScript disabled | Toasts invisible | Fallback to session flash messages. |
| Script load order | Toasts render after container | Ensure ToastMagic::scripts() is last in <body>. |
| Livewire version mismatch | Events fail silently | Validate livewire_version config. |
| XSS via unescaped input | Toast content injection | Escape dynamic content (e.g., e($input)). |
| Rapid duplicate toasts | UI lag/memory leaks | Enable preventDuplicates or debounce. |
| Asset pipeline conflicts | CSS/JS not loaded | Use Vite or manual asset publishing. |
ToastMagic::success()).dispatch calls).How can I help you explore Laravel packages today?