Skip to content

🍞 Laravel Toaster Magic β€” v2.2.0 Release Notes

Latest

Choose a tag to compare

@devrabiul devrabiul released this 17 Jun 11:35
20f0cee

🍞 Laravel Toaster Magic β€” v2.2.0 Release Notes

Release date: 2026-06-17
Type: Minor release β€” fully backward compatible

v2.2.0 is a "Trust & Polish" release. The package's scope is unchanged β€” it still does one thing, beautiful toast notifications for Laravel β€” but it is now more reliable, better tested, more compatible, and more pleasant to use. No breaking changes: existing apps can upgrade without touching their code.


✨ Highlights

  • βœ… Automated tests + CI across PHP 8.1–8.5 and Laravel 10–13 β€” every release is now verified, with a build-status badge on the README.
  • ⏱️ Per-toast duration β€” override timeOut / showDuration for a single toast.
  • πŸ–±οΈ Pause-on-hover β€” the auto-dismiss timer pauses while a user is reading a toast.
  • 🧹 Programmatic dismiss β€” toastMagic.clear() / toastMagic.dismissAll() from JavaScript.
  • πŸ” preventDuplicates now actually works.
  • 🧾 Validation MessageBag support β€” pass $validator->errors() straight into a toast.
  • πŸͺ„ The documented fluent API now works β€” ToastMagic::dispatch()->success(...).

πŸš€ What's New

Per-toast duration overrides

timeOut and showDuration can now be set per toast (in milliseconds), falling back to your global config when omitted:

ToastMagic::success('Saved!', 'Your changes are live.', [
    'timeOut' => 10000,   // keep this one on screen longer
    'showDuration' => 300,
]);

Also supported through Livewire event options.

Pause-on-hover

Toasts no longer disappear while a user is hovering over them. This is enabled by default. To restore the old always-auto-dismiss behavior, set:

// config/laravel-toaster-magic.php
'options' => [
    'pauseOnHover' => false,
],

Programmatic dismiss API

toastMagic.clear();       // dismiss all visible toasts
toastMagic.dismissAll();  // alias of clear()

Validation errors in one line

ToastMagic::error($validator->errors());

The MessageBag is flattened into a single toast, one message per line.

Fluent dispatch syntax

ToastMagic::dispatch()->success('User Created', 'The user has been created.');

πŸ› Fixes

  • preventDuplicates is now honored by the JavaScript runtime β€” identical, currently-visible toasts (same type, heading, and description) are skipped when the option is enabled. Previously the option existed but did nothing.
  • clear() now also clears already-queued messages from the session, not just the in-memory list.
  • MessageBag passed to a toast type no longer throws a TypeError β€” the message-flattening path is now reachable.
  • The README dispatch() example previously referenced a method that didn't exist; it now works as documented.

πŸ”’ Security note

The README's blanket "XSS Safe" wording has been corrected to be precise:

  • Custom button URLs are sanitized.
  • Toast heading/description content is rendered as HTML (this is what enables multi-line messages). Do not pass unescaped, user-supplied input into a toast β€” escape it first, e.g. with Laravel's e() helper.
ToastMagic::success('Welcome, ' . e($user->name) . '!');

Coming in v3.0.0: message content will be escaped by default, with an opt-in flag for intentional HTML.


🧩 Compatibility

Requirement Supported
PHP 8.0 – 8.5
Laravel 8 – 13
Livewire v3 & v4

composer.json now declares these constraints explicitly, so Composer can warn you about an incompatible stack.

Note: CI verifies PHP 8.1–8.5 with Laravel 10–13. PHP 8.0 and Laravel 8/9 remain supported per the declared constraints but are not exercised in the automated matrix (no current Laravel release runs on PHP 8.0).


⬆️ Upgrade Guide

composer update devrabiul/laravel-toaster-magic

That's it β€” no code changes required. Assets are auto-refreshed on the next page load (or run php artisan vendor:publish --provider="Devrabiul\ToastMagic\ToastMagicServiceProvider" to re-publish the config).

The only behavior change is pause-on-hover, which is on by default. If you specifically relied on toasts dismissing while hovered, set 'pauseOnHover' => false in your config.


πŸ™ Thanks

Thanks to everyone using and reporting issues on Laravel Toaster Magic. If it helps you in production, consider planting a tree. 🌱

Full changelog: see CHANGELOG.md.