PHPackages                             turndale/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. turndale/toast

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

turndale/toast
==============

A Laravel Package for Flux Toast integration

v1.0.5(3mo ago)033MITPHPPHP ^8.2

Since Feb 2Pushed 3mo agoCompare

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

READMEChangelogDependencies (5)Versions (6)Used By (0)

Toast
=====

[](#toast)

A Laravel Package for Flux Toast integration.

This package provides a wrapper around [Livewire Flux](https://fluxui.dev) Toasts to simplify their usage and parameter arrangement, and adds support for flash messages using Laravel sessions.

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

[](#installation)

You can install the package via composer:

```
composer require turndale/toast
```

Setup
-----

[](#setup)

Add the toast partial to your layout file (e.g., `resources/views/components/layouts/app.blade.php`).

**Important:** The `@include('toast::partials.toast')` must be placed **after** `@fluxScripts` because it uses the `$flux.toast()` function which is only available after Flux scripts are loaded.

```

    @fluxScripts
    @include('toast::partials.toast')

```

Usage
-----

[](#usage)

### Quick Reference

[](#quick-reference)

MethodUse CaseWhen Toast Shows`toast()->success()`Livewire componentsImmediately`toast()->flashSuccess()`After redirectNext page load`session()->flash('success', 'msg')`After redirectNext page load`redirect()->with('success', 'msg')`After redirectNext page load`toast()->sessionSuccess()`Same page alertCurrent page---

Instant Toasts (Same Page)
--------------------------

[](#instant-toasts-same-page)

These methods show a toast immediately on the current page. Use these in Livewire components or anywhere you don't need a redirect.

### `alert()`

[](#alert)

Show a simple alert toast.

```
toast()->alert('Something happened.');
toast()->alert('Something happened.', 'Notice');
toast()->alert('Something happened.', 'Notice', 3000);
```

**Signature:** `alert(string $message = '', string $title = '', int $duration = 6000): void`

---

### `success()`

[](#success)

Show a success toast.

```
toast()->success('Operation completed successfully!');
toast()->success('Profile updated', 'Success');
toast()->success('Profile updated', 'Success', 3000);
```

**Signature:** `success(string $message = '', string $title = '', int $duration = 6000): void`

---

### `error()`

[](#error)

Show an error toast.

```
toast()->error('Something went wrong.');
toast()->error('Failed to save', 'Error');
toast()->error('Failed to save', 'Error', 8000);
```

**Signature:** `error(string $message = '', string $title = '', int $duration = 6000): void`

---

### `warning()`

[](#warning)

Show a warning toast.

```
toast()->warning('Please review your input.');
toast()->warning('Unsaved changes', 'Warning');
toast()->warning('Unsaved changes', 'Warning', 5000);
```

**Signature:** `warning(string $message = '', string $title = '', int $duration = 6000): void`

---

### `server()`

[](#server)

Show a server error toast with sensible defaults.

```
toast()->server(); // "Try again later or contact support" with title "Something went wrong"
toast()->server('Custom error message');
toast()->server('Custom message', 'Custom Title');
toast()->server('Custom message', 'Custom Title', 'warning', 8000);
```

**Signature:** `server(string $message = 'Try again later or contact support', string $title = 'Something went wrong', string $type = 'danger', int $duration = 6000): void`

---

### `invalid()`

[](#invalid)

Show a validation error toast with sensible defaults.

```
toast()->invalid(); // "Check form for validation errors"
toast()->invalid('Please fix the errors below.');
toast()->invalid('Please fix the errors', 'Validation Error');
```

**Signature:** `invalid(string $message = 'Check form for validation errors', string $title = '', string $type = 'danger', int $duration = 6000): void`

---

Flash Toasts (After Redirect)
-----------------------------

[](#flash-toasts-after-redirect)

Flash messages are stored in the session and displayed on the next page load. Use these when redirecting after form submissions.

### Using Toast Helper Methods

[](#using-toast-helper-methods)

#### `flash()`

[](#flash)

Flash a basic toast message.

```
toast()->flash('Your session has been updated.');
toast()->flash('Your session has been updated.', 'Notice');
toast()->flash('Your session has been updated.', 'Notice', 3000);

return redirect()->route('dashboard');
```

**Signature:** `flash(string $message = '', string $title = '', int $duration = 6000): void`

---

#### `flashSuccess()`

[](#flashsuccess)

Flash a success toast message.

```
toast()->flashSuccess('Your changes have been saved.');
toast()->flashSuccess('Profile updated successfully!', 'Success');
toast()->flashSuccess('Done!', 'Success', 3000);

return redirect()->route('profile');
```

**Signature:** `flashSuccess(string $message = '', string $title = '', int $duration = 6000): void`

---

#### `flashError()`

[](#flasherror)

Flash an error toast message.

```
toast()->flashError('Something went wrong.');
toast()->flashError('Failed to process request.', 'Error');
toast()->flashError('Please try again.', 'Error', 8000);

return redirect()->back();
```

**Signature:** `flashError(string $message = '', string $title = '', int $duration = 6000): void`

---

#### `flashWarning()`

[](#flashwarning)

Flash a warning toast message.

```
toast()->flashWarning('Please review your input.');
toast()->flashWarning('Some fields are missing.', 'Warning');
toast()->flashWarning('Incomplete data.', 'Warning', 5000);

return redirect()->back();
```

**Signature:** `flashWarning(string $message = '', string $title = '', int $duration = 6000): void`

---

#### `flashInfo()`

[](#flashinfo)

Flash an info toast message.

```
toast()->flashInfo('New features are available.');
toast()->flashInfo('Check out our latest updates.', 'Info');
toast()->flashInfo('Version 2.0 released!', 'Info', 5000);

return redirect()->route('home');
```

**Signature:** `flashInfo(string $message = '', string $title = '', int $duration = 6000): void`

---

#### `flashServer()`

[](#flashserver)

Flash a server error toast with sensible defaults.

```
toast()->flashServer(); // "Something went wrong, please try again later or contact support"
toast()->flashServer('Unable to connect to server.');
toast()->flashServer('Service unavailable.', 'Server Error');

return redirect()->back();
```

**Signature:** `flashServer(string $message = 'Something went wrong, please try again later or contact support', string $title = '', int $duration = 6000): void`

---

### Using Laravel's Native Session

[](#using-laravels-native-session)

The package also supports Laravel's familiar session patterns. These are great for simple messages.

#### Using `session()->flash()`

[](#using-session-flash)

```
session()->flash('success', 'Your changes have been saved.');
session()->flash('error', 'Something went wrong.');
session()->flash('warning', 'Please review your input.');
session()->flash('info', 'New updates available.');

return redirect()->route('dashboard');
```

#### Using `->with()` on Redirects

[](#using--with-on-redirects)

```
return redirect()->route('dashboard')->with('success', 'Profile updated!');
return redirect()->back()->with('error', 'Invalid credentials.');
return redirect()->route('home')->with('warning', 'Session expiring soon.');
return redirect()->route('news')->with('info', 'New features available!');
```

#### Simple Flash Helpers

[](#simple-flash-helpers)

These are convenience wrappers around `session()->flash()`:

```
toast()->simpleFlashSuccess('Your changes have been saved.');
toast()->simpleFlashError('Something went wrong.');
toast()->simpleFlashWarning('Please review your input.');
toast()->simpleFlashInfo('New updates available.');
toast()->simpleFlash('success', 'Generic flash message.');

return redirect()->route('dashboard');
```

MethodSignature`simpleFlash()``simpleFlash(string $type, string $message): void``simpleFlashSuccess()``simpleFlashSuccess(string $message): void``simpleFlashError()``simpleFlashError(string $message): void``simpleFlashWarning()``simpleFlashWarning(string $message): void``simpleFlashInfo()``simpleFlashInfo(string $message): void`---

### Full Control with Array Syntax

[](#full-control-with-array-syntax)

For more control over the toast (custom heading, duration, variant), use the array syntax:

```
session()->flash('toast', [
    'text' => 'Your changes have been saved.',
    'heading' => 'Success',        // Optional, defaults to ''
    'variant' => 'success',        // Optional: 'success', 'danger', 'warning'
    'duration' => 6000,            // Optional, defaults to 6000
]);

return redirect()->route('dashboard');
```

Or with redirect's `->with()`:

```
return redirect()->route('dashboard')->with('toast', [
    'text' => 'Welcome back!',
    'heading' => 'Hello',
    'variant' => 'success',
    'duration' => 3000,
]);
```

---

Same-Page Session Alerts
------------------------

[](#same-page-session-alerts)

For alerts on the same page without redirect, you can store messages in the session. These persist until manually cleared or page refresh.

### Using Toast Helper

[](#using-toast-helper)

```
toast()->sessionSuccess('Record saved successfully.');
toast()->sessionError('Failed to load data.');
toast()->sessionWarning('Connection unstable.');
toast()->sessionInfo('Background sync in progress.');
```

MethodSignature`sessionSuccess()``sessionSuccess(string $message): void``sessionError()``sessionError(string $message): void``sessionWarning()``sessionWarning(string $message): void``sessionInfo()``sessionInfo(string $message): void`### Using Laravel's Native Session

[](#using-laravels-native-session-1)

```
session(['success' => 'Record saved successfully.']);
session(['error' => 'Failed to load data.']);
session(['warning' => 'Connection unstable.']);
session(['info' => 'Background sync in progress.']);
```

> **Note:** Same-page session alerts persist until manually cleared or page refresh. For redirects, use flash messages instead.

---

Supported Variants
------------------

[](#supported-variants)

VariantToast HelperSession KeyDefault`alert()`-Success`success()`, `flashSuccess()``success`Error/Danger`error()`, `flashError()``error`Warning`warning()`, `flashWarning()`, `flashInfo()``warning`, `info`> **Note:** Flux only supports `success`, `warning`, and `danger` variants. The `info` methods and session key are provided for convenience and map to the `warning` variant.

---

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

[](#requirements)

- PHP 8.2+
- Laravel 12+
- Livewire 3+
- Flux Pro (Toast component is a Pro Component)

---

Why This Package?
-----------------

[](#why-this-package)

Regular Flux Toast usage requires named arguments:

```
Flux::toast(
    text: 'Your profile has been updated.',
    heading: 'Success',
    variant: 'success',
    duration: 6000
);
```

This package simplifies it to:

```
toast()->success('Your profile has been updated.', 'Success');
```

And for redirects:

```
// Before (manual)
session()->flash('toast', [
    'text' => 'Profile updated!',
    'variant' => 'success',
]);
return redirect()->route('profile');

// After (with this package)
toast()->flashSuccess('Profile updated!');
return redirect()->route('profile');

// Or even simpler
return redirect()->route('profile')->with('success', 'Profile updated!');
```

---

Defaults
--------

[](#defaults)

- **Duration**: By default, Flux toasts last for 5 seconds (5000ms). This package changes the default to **6 seconds (6000ms)** to give users slightly more time to read notifications. You can override this by passing a duration argument to any method that supports it.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance81

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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

Every ~0 days

Total

6

Last Release

102d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad63f515427a7f3f34d8c23c8344f91fec1cba8ef7c8cb98da769b42c7990970?d=identicon)[hellofromsteve](/maintainers/hellofromsteve)

---

Top Contributors

[![hellofromsteve](https://avatars.githubusercontent.com/u/131690895?v=4)](https://github.com/hellofromsteve "hellofromsteve (6 commits)")

---

Tags

laravelfluxalerttoastturndale

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[masmerise/livewire-toaster

Beautiful toast notifications for Laravel / Livewire.

505550.3k6](/packages/masmerise-livewire-toaster)[realrashid/sweet-alert

Laravel Sweet Alert Is A Package For Laravel Provides An Easy Way To Display Alert Messages Using The SweetAlert2 Library.

1.2k2.9M21](/packages/realrashid-sweet-alert)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[revolution/self-ordering

Self Ordering System

2112.7k](/packages/revolution-self-ordering)[joelwmale/livewire-quill

Easily add QuillJS with image support to any Laravel Livewire component.

1314.0k](/packages/joelwmale-livewire-quill)

PHPackages © 2026

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