PHPackages                             sndpbag/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. [Mail &amp; Notifications](/categories/mail)
4. /
5. sndpbag/laravel-toast

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

sndpbag/laravel-toast
=====================

A beautiful and feature-rich toast notification package for Laravel

1.0.0(6mo ago)08MITPHPPHP ^8.0|^8.1|^8.2|^8.3CI failing

Since Oct 20Pushed 6mo agoCompare

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

READMEChangelogDependencies (3)Versions (2)Used By (0)

Laravel Toast Notifications
===========================

[](#laravel-toast-notifications)

[![Latest Version](https://camo.githubusercontent.com/46cea301330f67782a57f5028e0e4e6d4aa881fd2f9a8eb0a84a89408556d3a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736e64706261672f6c61726176656c2d746f6173742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/46cea301330f67782a57f5028e0e4e6d4aa881fd2f9a8eb0a84a89408556d3a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736e64706261672f6c61726176656c2d746f6173742e7376673f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/455be70b7cb87097ea7e39c09de405b443e3a5957d968f314fdda345e39816fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736e64706261672f6c61726176656c2d746f6173742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/455be70b7cb87097ea7e39c09de405b443e3a5957d968f314fdda345e39816fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736e64706261672f6c61726176656c2d746f6173742e7376673f7374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/3cfcdfa38581557a4a7ca234f7d67e56c7936f1c5caa2b13603048e390787f42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736e64706261672f6c61726176656c2d746f6173742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/3cfcdfa38581557a4a7ca234f7d67e56c7936f1c5caa2b13603048e390787f42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736e64706261672f6c61726176656c2d746f6173742e7376673f7374796c653d666c61742d737175617265)

A beautiful, feature-rich, and highly customizable toast notification package for Laravel. Built with modern design principles and accessibility in mind.

✨ Features
----------

[](#-features)

- 🎨 **7 Toast Types**: Success, Error, Warning, Info, Loading, Promise, Custom
- 📍 **6 Positions**: Top/Bottom × Left/Center/Right
- ⚡ **Auto-dismiss** with customizable duration
- ⏸️ **Pause on Hover**
- 📊 **Progress Bar** showing remaining time
- 🎭 **Multiple Animations**: Slide, Fade, Bounce, Zoom
- 🌓 **Dark/Light Theme** with auto-detection
- ♿ **Accessibility**: Full ARIA support &amp; keyboard navigation
- 🔄 **Prevent Duplicates**
- 🎯 **Action Buttons** in toasts
- 🔗 **Clickable Toasts** with URL redirect
- ⏳ **Promise Support** for async operations
- 🎨 **Custom Icons** support
- 📱 **Responsive Design**
- 🔧 **Highly Configurable**
- 🚀 **Zero Dependencies** (Vanilla JS)

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require sndpbag/laravel-toast
```

### Publish Configuration &amp; Assets

[](#publish-configuration--assets)

```
php artisan vendor:publish --provider="sndpbag\LaravelToast\ToastServiceProvider"
```

Or publish individually:

```
# Publish config only
php artisan vendor:publish --tag=toast-config

# Publish views only
php artisan vendor:publish --tag=toast-views

# Publish assets only
php artisan vendor:publish --tag=toast-assets
```

🚀 Quick Start
-------------

[](#-quick-start)

### 1. Add to Your Layout

[](#1-add-to-your-layout)

Add this directive before closing `` tag in your layout file:

```

    My App

    @sndpToast

```

### 2. Use in Controllers

[](#2-use-in-controllers)

```
use sndpbag\LaravelToast\Facades\Toast;

class UserController extends Controller
{
    public function store(Request $request)
    {
        // Create user...

        Toast::success('User created successfully!');

        return redirect()->route('users.index');
    }
}
```

📖 Usage Examples
----------------

[](#-usage-examples)

### Basic Usage

[](#basic-usage)

```
// Success toast
Toast::success('Operation completed successfully!');

// Error toast
Toast::error('Something went wrong!');

// Warning toast
Toast::warning('Please check your input!');

// Info toast
Toast::info('New updates available!');

// Loading toast (doesn't auto-dismiss)
Toast::loading('Processing your request...');

// Custom toast with custom styling
Toast::custom('Custom notification message', 'Custom Title', [
    'icon' => '...',
    'duration' => 5000
]);
```

### With Title

[](#with-title)

```
Toast::success('User Created', 'John Doe has been added to the system');

Toast::error('Delete Failed', 'You do not have permission to delete this item');
```

### With Options

[](#with-options)

```
Toast::success('Saved!', 'Your changes have been saved', [
    'duration' => 5000,
    'position' => 'top-center',
    'showProgressBar' => false,
]);
```

### With Action Buttons

[](#with-action-buttons)

```
Toast::info('File deleted', 'The file has been moved to trash')
    ->withActions([
        [
            'label' => 'Undo',
            'action' => 'undo',
            'callback' => 'handleUndo()'
        ],
        [
            'label' => 'View',
            'action' => 'view',
            'callback' => 'viewTrash()'
        ]
    ]);
```

### Clickable Toast with URL

[](#clickable-toast-with-url)

```
Toast::info('New message received')
    ->clickable(route('messages.show', $message->id));
```

### Custom Icon

[](#custom-icon)

```
Toast::success('Profile Updated')
    ->withIcon('...'); // Your custom SVG icon

// Or use emoji
Toast::success('Welcome!')
    ->withIcon('👋');
```

### Multiple Toasts

[](#multiple-toasts)

```
Toast::success('First task completed');
Toast::info('Second task in progress');
Toast::warning('Third task needs attention');
```

### Loading Toast Example

[](#loading-toast-example)

```
// Show loading toast while processing
Toast::loading('Processing payment...', 'Please wait');

// After process completes, redirect with success/error toast
if ($paymentSuccess) {
    Toast::success('Payment successful!');
} else {
    Toast::error('Payment failed!');
}

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

### Chaining Methods

[](#chaining-methods)

```
Toast::success('Post Published', 'Your post is now live!')
    ->clickable(route('posts.show', $post->id))
    ->withActions([
        ['label' => 'View', 'action' => 'view', 'callback' => 'viewPost()'],
        ['label' => 'Share', 'action' => 'share', 'callback' => 'sharePost()']
    ]);
```

### Promise Toasts (For Async Operations)

[](#promise-toasts-for-async-operations)

Perfect for showing loading state and updating to success/error:

```
// In your controller
public function uploadFile(Request $request)
{
    // Show loading toast
    $toastId = Toast::promise('Uploading file...', 'Please wait');

    try {
        // Perform the operation
        $file = $request->file('document');
        $file->store('uploads');

        // Update to success
        Toast::promiseSuccess($toastId, 'File uploaded successfully!', 'Done');

    } catch (\Exception $e) {
        // Update to error
        Toast::promiseError($toastId, 'Failed to upload file', 'Error');
    }

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

**AJAX Example:**

```
// Make AJAX request and show promise toast
fetch('/api/upload', {
    method: 'POST',
    body: formData
})
.then(response => {
    // Success - page will show updated toast on redirect
    window.location.href = '/dashboard';
})
.catch(error => {
    // Error - page will show error toast on redirect
    window.location.href = '/dashboard';
});
```', 'action' => 'view', 'callback' => 'viewPost()'],
        ['label' => 'Share', 'action' => 'share', 'callback' => 'sharePost()']
    ]);
```

⚙️ Configuration
----------------

[](#️-configuration)

The `config/toast.php` file contains all configuration options:

```
return [
    // Position: 'top-left', 'top-center', 'top-right',
    //           'bottom-left', 'bottom-center', 'bottom-right'
    'position' => 'top-right',

    // Duration in milliseconds (0 = persistent)
    'duration' => 3000,

    // Show close button
    'show_close_button' => true,

    // Show progress bar
    'show_progress_bar' => true,

    // Pause on hover
    'pause_on_hover' => true,

    // Prevent duplicate toasts
    'prevent_duplicates' => true,

    // Animations
    'animation' => [
        'enter' => 'slideInRight',
        'exit' => 'slideOutRight',
    ],

    // Theme: 'light', 'dark', or 'auto'
    'theme' => 'light',

    // Maximum toasts to show at once
    'max_toasts' => 5,

    // Stack direction: 'up' or 'down'
    'stack_direction' => 'down',

    // Accessibility settings
    'accessibility' => [
        'role' => 'alert',
        'aria_live' => 'polite',
    ],
];
```

### Environment Variables

[](#environment-variables)

You can override config values using `.env`:

```
TOAST_POSITION=top-right
TOAST_DURATION=3000
TOAST_THEME=dark
TOAST_SHOW_PROGRESS_BAR=true
TOAST_PAUSE_ON_HOVER=true
TOAST_PREVENT_DUPLICATES=true
```

🎨 Available Animations
----------------------

[](#-available-animations)

### Entry Animations

[](#entry-animations)

- `slideInRight`
- `slideInLeft`
- `slideInTop`
- `slideInBottom`
- `fadeIn`
- `bounceIn`
- `zoomIn`

### Exit Animations

[](#exit-animations)

- `slideOutRight`
- `slideOutLeft`
- `slideOutTop`
- `slideOutBottom`
- `fadeOut`
- `bounceOut`
- `zoomOut`

🎯 Available Options
-------------------

[](#-available-options)

When creating a toast, you can pass these options:

```
Toast::success('Message', 'Title', [
    'duration' => 3000,              // Auto-dismiss time (ms), 0 = persistent
    'position' => 'top-right',       // Toast position
    'showCloseButton' => true,       // Show/hide close button
    'showProgressBar' => true,       // Show/hide progress bar
    'pauseOnHover' => true,          // Pause auto-dismiss on hover
    'showIcon' => true,              // Show/hide icon
    'clickable' => false,            // Make toast clickable
    'url' => null,                   // URL for clickable toast
    'preventDuplicates' => true,     // Prevent duplicate toasts
    'icon' => '...',      // Custom icon HTML
    'animation' => [
        'enter' => 'slideInRight',   // Entry animation
        'exit' => 'slideOutRight',   // Exit animation
    ],
]);
```

🌐 Helper Function
-----------------

[](#-helper-function)

You can also use the global `toast()` helper:

```
// If you add this to your helpers file
function toast() {
    return app('toast');
}

// Then use it like:
toast()->success('Hello World!');
```

🧪 Testing
---------

[](#-testing)

```
composer test
```

📝 Changelog
-----------

[](#-changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

🔒 Security
----------

[](#-security)

If you discover any security-related issues, please email your.  instead of using the issue tracker.

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

🙏 Credits
---------

[](#-credits)

- **sandipan kr bag** - Creator
- All contributors

🌟 Show Your Support
-------------------

[](#-show-your-support)

If you find this package helpful, please consider giving it a ⭐ on GitHub!

---

Made with ❤️ for the Laravel community

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity4

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

Unknown

Total

1

Last Release

204d ago

### Community

Maintainers

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

---

Top Contributors

[![sndpbag](https://avatars.githubusercontent.com/u/142666414?v=4)](https://github.com/sndpbag "sndpbag (8 commits)")

---

Tags

messagelaravelnotificationflashalerttoastsndpbag

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[loveorigami/yii2-notification-wrapper

This module for renders a message from session flash (with ajax, pjax support and etc.)

77199.7k5](/packages/loveorigami-yii2-notification-wrapper)[bpocallaghan/alert

A helper package to flash a bootstrap alert to the browser.

1819.6k3](/packages/bpocallaghan-alert)[ras/flash-alert-bundle

FlashAlertBundle provides a simplified way to handle (add/display) Symfony flash messages. Client side scripts are written in pure JavaScript.

2423.3k](/packages/ras-flash-alert-bundle)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.4k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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