Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Toaster Laravel Package

nawasara/toaster

Lightweight Alpine-powered toast notifications for Laravel and Livewire. Add one component to your layout and trigger success/error/warning/info toasts from JavaScript, Livewire, or session flash. Configurable position, optional progress bar, dark-mode aware.

View on GitHub
Deep Wiki
Context7

Nawasara Toaster

Lightweight, Alpine-based toast notification component for Laravel and Livewire applications. Drop one component into your layout and trigger toasts from JavaScript, Livewire, or session flash.

Features

  • Four toast types — success, error, warning, info
  • Configurable position — nine corner/edge anchors
  • Progress bar — optional countdown indicator
  • Dark-mode aware — respects the host application's theme
  • Mobile responsive
  • Triggers from anywhere — JavaScript (window.Toast), Livewire dispatch, or Laravel session flash
  • Auto-init from flash — shows the toast on next page load when redirected with a flash payload

Installation

composer require nawasara/toaster

Auto-discovered. Drop the toaster + script components into your layout:

<x-nawasara-toaster::script />

{{-- … your content … --}}

<x-nawasara-toaster::toaster position="top-right" :duration="5000" />

Usage

From JavaScript

window.Toast.success('Saved successfully');
window.Toast.error('Something went wrong');
window.Toast.warning('Heads up');
window.Toast.info('FYI');

From Laravel session flash

session()->flash('toast', [
    'type' => 'success',
    'message' => 'Saved successfully',
]);

return redirect()->back();

The toaster auto-loads the flash payload via window.Laravel.toast on the next page render.

From Livewire

Use the HasToaster trait if you prefer session-flash style (works after a redirect):

use Livewire\Component;
use Nawasara\Toaster\Concerns\HasToaster;

class MyComponent extends Component
{
    use HasToaster;

    public function save()
    {
        // …
        $this->alert('success', 'Saved successfully');
    }
}

For real-time toasts inside the same Livewire request (no page reload), use Nawasara\Ui\Livewire\Concerns\HasBrowserToast from nawasara/ui — it dispatches a browser toast event the toaster listens to.

Author

Pringgo J. Saputro <odyinggo@gmail.com>

License

MIT

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky