PHPackages                             shufflingpixels/laravel-toast - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. shufflingpixels/laravel-toast

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

shufflingpixels/laravel-toast
=============================

Lightweight toast backend with session flash support for Laravel

v0.1.0(7mo ago)0116↓33.3%1AGPL-3.0-or-laterPHPPHP &gt;=8.1

Since Oct 5Pushed 7mo agoCompare

[ Source](https://github.com/shufflingpixels/laravel-toast)[ Packagist](https://packagist.org/packages/shufflingpixels/laravel-toast)[ RSS](/packages/shufflingpixels-laravel-toast/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Laravel Toast
=============

[](#laravel-toast)

Lightweight toast backend with session flash support for Laravel.

It lets you create, collect, and flash toast messages on the backend, while leaving full control over how you render them on the frontend. Pair it with your preferred UI, or use our suggested Livewire/Tailwind frontend.

Frontends
---------

[](#frontends)

- `shufflingpixels/laravel-toast-flux` (Livewire Flux + Tailwind + Alpine).

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10+ (or `illuminate/support` &gt;= 10)

Installation
------------

[](#installation)

```
composer require shufflingpixels/laravel-toast
```

The service provider and facade alias are auto-discovered. You can use the facade `Toast` immediately.

Concepts
--------

[](#concepts)

- Message: a typed object with `severity`, `text`, optional `details`, and `duration` (ms).
- Manager: collects messages during a request and can flash a single message across redirects via session.
- Severities: `info`, `success`, `warning`, `error`.

Quick Start
-----------

[](#quick-start)

Createa toast message in a controller action:

```
use ShufflingPixels\Toast\Toast;

public function store()
{
    Toast::success('Saved successfully');

    return view('profile');
}
```

In your Blade view, pull messages and render them however you like:

```
@php($messages = \ShufflingPixels\Toast\Toast::getMessages())

@if ($messages->isNotEmpty())

        @foreach ($messages as $message)

                {{ $message->text }}
                @if ($message->details)
                    {{ $message->details }}
                @endif

        @endforeach

@endif
```

or use one of the frontent packages

Flash Across Redirects
----------------------

[](#flash-across-redirects)

To show a toast on the next request (after redirect), flash the message:

```
use Toast;

public function update()
{
    Toast::success('Profile updated')->flash();

    return redirect()->route('profile.show');
}
```

On the subsequent request, call `Toast::getMessages()` in your layout or view; flashed messages are merged into the in-memory collection and cleared from the session automatically.

Helper Function
---------------

[](#helper-function)

This package provides a global `toast()` helper that returns the manager. If you pass a severity and text, it will create the message immediately.

```
use ShufflingPixels\Toast\Severity;

// Get the manager and add messages fluently
toast()->info('Heads up');
toast()->success('Saved', 'All changes are synced', 5000);

// Create immediately via helper (one-liner)
toast(Severity::ERROR, 'Something went wrong', 'Please try again');

// Flash a specific message for the next request
toast()->warning('Requires attention')->flash();
```

Helper signature:

```
function toast(?Severity $severity = null, ?string $text = null, ?string $details = null, int $duration = 3000): \ShufflingPixels\Toast\Manager
```

API Reference
-------------

[](#api-reference)

Facade:

```
use ShufflingPixels\Toast\Toast;

// Create messages (returns Message)
Toast::info(string $text, ?string $details = null, int $duration = 3000);
Toast::success(string $text, ?string $details = null, int $duration = 3000);
Toast::warning(string $text, ?string $details = null, int $duration = 3000);
Toast::error(string $text, ?string $details = null, int $duration = 3000);
Toast::new(Severity $severity, string $text, ?string $details = null, int $duration = 3000);

// Flash a single message to session
Toast::flash(\ShufflingPixels\Toast\Message $message): void;

// Retrieve all messages for the current request
Toast::getMessages(): Illuminate\Support\Collection;

// Retrieve flashed messages without merging
Toast::getFlashMessages(): Illuminate\Support\Collection;
```

Message object:

```
new Message(Severity $severity, string $text, ?string $details = null, int $duration = 3000);

// Chainable setters
$message->severity(Severity::SUCCESS)
        ->text('Saved')
        ->details('All good')
        ->duration(3000)
        ->flash();
```

Severities enum:

```
Severity::INFO
Severity::SUCCESS
Severity::WARN   // alias value: "warning"
Severity::ERROR
```

Blade Stubs (Optional)
----------------------

[](#blade-stubs-optional)

The package ships minimal Blade stubs you can copy and adapt:

- `src/stubs/container.blade.php` – loops over `Toast::getMessages()` and renders each message via a component.
- `src/stubs/message.blade.php` – minimal message markup.

Feel free to inline the logic in your layout or create your own Blade components.

Notes
-----

[](#notes)

- Default duration is `3000` ms; use it to control how long a toast should stay visible on the frontend.
- Flashed messages are stored under the session key `shufflingpixels.toast.flash` and are cleared when read via `getMessages()`.
- This package does not include any JavaScript; you own the presentation and dismissal logic.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance64

Regular maintenance activity

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

218d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06e7f13d9bb15fe5b1d5d3585380ba9085a36924da87066a002a4f2c5fe173a1?d=identicon)[pnx](/maintainers/pnx)

---

Top Contributors

[![pnx](https://avatars.githubusercontent.com/u/398903?v=4)](https://github.com/pnx "pnx (3 commits)")

### Embed Badge

![Health badge](/badges/shufflingpixels-laravel-toast/health.svg)

```
[![Health](https://phpackages.com/badges/shufflingpixels-laravel-toast/health.svg)](https://phpackages.com/packages/shufflingpixels-laravel-toast)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M686](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M861](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
