Search by

Toast notifications for Laravel: call Toast::success('Saved.') on the server and it shows in the browser, after a redirect or a full page, with optional Nitro Fusion support.

Package info

github.com/laravelopenpackages/toast

pkg:composer/laravelopenpackages/toast

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-10-07 14:10 UTC

This package is auto-updated.

Last update: 2026-10-07 14:20:57 UTC


README

Toast notifications for Laravel. Raise one on the server, it shows in the browser:

use LaravelOpenPackages\Toast\Facades\Toast;

Toast::success('Student saved.');
Toast::error('Could not save.', title: 'Error');
Toast::warning('Fee plan has no subjects.', duration: 0);   // stays until dismissed
Toast::info('Import queued.');

Place the container once in your layout, before </body>:

<x-toast::container />

Installation

composer require laravelopenpackages/toast

The service provider and the Toast alias register themselves.

How a toast reaches the page

A toast raised during a request is flashed to the session and shown when the next page renders <x-toast::container />: after a redirect, or on the page the request itself returns.

From the browser, dispatch a toast event:

window.dispatchEvent(new CustomEvent('toast', { detail: { type: 'success', message: 'Copied' } }));
window.LaravelToast.show({ type: 'success', message: 'Copied', title: null, duration: 4000 });

Integrations

  • Nitro Fusion, detected when installed: toasts travel as Fusion flash data instead of the session, so one raised in a #[Server] call arrives with the call's answer. In a view, $dispatch('toast', 'success', 'Copied') raises one in the browser. Set toast.fusion to false to use the session only.

Messages are always shown as text, never as HTML.

Configuration

php artisan vendor:publish --tag=toast-config
Key Default
duration 4000 Milliseconds on screen; 0 keeps a toast until it is dismissed (TOAST_DURATION)
position top-right top-right, top-left, bottom-right or bottom-left (TOAST_POSITION)
fusion true Send toasts as Fusion flash data when Fusion is installed

The container brings its own small stylesheet, so it needs nothing from your CSS build. php artisan vendor:publish --tag=toast-views copies the view to restyle it.

Octane

The toast manager is bound scoped, so one request's toasts never reach the next.