Skip to main content
The PHP API lets you trigger toasts directly from controllers, jobs, or any PHP code. Works with any Laravel project — no Livewire required.

Quick start

Import the facade:
use A89s\GooeyToast\Facades\GooeyToast;
Show a toast:
GooeyToast::success('Saved!');

Quick methods

Four convenience methods for common toast types:
GooeyToast::success('Saved!');
GooeyToast::success('User created', 'John Doe has been added to the team.');
The second parameter adds an optional message text block below the title.

Fluent builder

For full control, use the fluent builder API:
GooeyToast::make('Title', 'success')
    ->message('Additional message')
    ->send();

With avatar

GooeyToast::make('New message', 'info')
    ->avatar('/avatars/user.jpg')
    ->avatarSize('32px')
    ->send();

Full configuration

GooeyToast::make('Deployment complete', 'success')
    ->details([
        ['label' => 'Environment', 'value' => 'Production'],
        ['label' => 'Branch', 'value' => 'main'],
    ])
    ->footer('https://deploy.example.com/logs/123')
    ->duration(5000)
    ->send();

Message text

Display plain text instead of structured details:
GooeyToast::make('Melissa', 'info')
    ->avatar('/avatars/melissa.jpg')
    ->message('Please visit HR when you get a chance 👋')
    ->footer('1h ago')
    ->send();

Details

Add expandable key-value rows:
GooeyToast::make('Server error', 'error')
    ->details([
        ['label' => 'Status', 'value' => '500'],
        ['label' => 'Endpoint', 'value' => '/api/users'],
    ])
    ->send();
Or build details one row at a time:
GooeyToast::make('Report generated', 'success')
    ->detail('File', 'monthly-report.pdf')
    ->detail('Size', '2.3 MB')
    ->detail('Pages', '47')
    ->send();

Action buttons

Add clickable buttons that dispatch JavaScript events:
GooeyToast::make('Message sent', 'success')
    ->action('View', 'view-message', 'external-link')
    ->send();
With custom color and confirmation:
GooeyToast::make('Delete account', 'warning')
    ->action('Delete', 'delete-account', 'trash', '#ef4444', confirm: true)
    ->send();

Multiple actions

GooeyToast::make('Incoming call', 'info')
    ->persistent()
    ->actions([
        ['label' => 'Accept', 'icon' => 'check', 'event' => 'accept', 'color' => '#22c55e'],
        ['label' => 'Decline', 'icon' => 'x', 'event' => 'decline', 'color' => '#ef4444'],
    ])
    ->send();

Persistent toasts

Prevent auto-dismissal:
GooeyToast::make('Connection lost', 'error')
    ->persistent()
    ->send();
Persistent toasts only close via the close button, an action button, or swipe gesture.

Custom colors

Override the type color:
GooeyToast::make('VIP Access Granted', 'success')
    ->color('#8b5cf6')
    ->send();

Duration

Set a custom auto-dismiss duration (in milliseconds):
GooeyToast::make('Quick message', 'info')
    ->duration(2000)
    ->send();

Vibration

Trigger device vibration (mobile only):
GooeyToast::make('Incoming call', 'info')
    ->vibrate([200, 100, 200])
    ->send();

Toast IDs

Assign a custom ID for later updates:
GooeyToast::make('Processing...', 'loading')
    ->id('task-123')
    ->send();
You can update this toast from JavaScript:
toast.update('task-123', { title: 'Complete!', type: 'success' });

Builder methods

title
string
Set the toast title.
->title('New title')
type
string
Set the toast type: success, error, warning, info, loading.
->type('error')
message
string
Set plain text message block.
->message('Additional details here')
details
array
Set expandable detail rows.
->details([
    ['label' => 'Key', 'value' => 'Value'],
])
detail
string, string
Add a single detail row.
->detail('Label', 'Value')
Set footer text.
->footer('Additional info')
actions
array
Set action buttons.
->actions([
    ['label' => 'Click', 'icon' => 'check', 'event' => 'my-event'],
])
action
string, string, ?string, ?string, bool
Add a single action button.
->action('Label', 'event-name', 'icon', '#22c55e', confirm: true)
Parameters: label, event, icon (optional), color (optional), confirm (optional)
vibrate
array|bool
Enable vibration on mobile.
->vibrate(true)
->vibrate([200, 100, 200])
duration
int
Set auto-dismiss duration in milliseconds.
->duration(5000)
persistent
Make toast persistent (never auto-dismiss).
->persistent()
color
string
Set custom color (hex or CSS color).
->color('#8b5cf6')
avatar
string
Set avatar image URL.
->avatar('/avatars/user.jpg')
avatarSize
string
Set avatar size (CSS unit).
->avatarSize('32px')
id
string
Set toast ID for later updates.
->id('my-toast-id')
send
Send the toast (stores in session for next page load).
->send()

Complete examples

<?php

namespace App\Http\Controllers;

use A89s\GooeyToast\Facades\GooeyToast;
use Illuminate\Http\Request;

class UserController extends Controller
{
    public function store(Request $request)
    {
        $validated = $request->validate([
            'name' => 'required',
            'email' => 'required|email',
        ]);
        
        $user = User::create($validated);
        
        GooeyToast::make('User created', 'success')
            ->message("Welcome {$user->name}!")
            ->detail('Email', $user->email)
            ->detail('ID', $user->id)
            ->send();
        
        return redirect()->route('users.index');
    }
    
    public function destroy($id)
    {
        User::findOrFail($id)->delete();
        
        GooeyToast::success('User deleted');
        
        return back();
    }
}

How it works

The PHP API stores toasts in the session. When the next page loads, the Blade component (<x-gooey-toast />) automatically displays and clears them.
Toasts triggered via the PHP API only appear on the next page load (after a redirect). For immediate toasts without a page refresh, use the JavaScript API or Livewire integration.

Build docs developers (and LLMs) love