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

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

jdw5/surge-toast
================

A Vue 3 + Inertia plugin to render headless toast components.

v0.1.0(2y ago)04MITPHPPHP ^8.1

Since Feb 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jdw5/surge-toast)[ Packagist](https://packagist.org/packages/jdw5/surge-toast)[ RSS](/packages/jdw5-surge-toast/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Surge Toast
===========

[](#surge-toast)

Server-side counterpart to `surge-toast-client` for Vue/Inertia. It provides a global macro to flash data to the session, with the client library automatically hooked up to receive router events from InertiaJs.

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

[](#installation)

Install the package via composer:

```
composer require jdw5/surge-toast
```

To provide the link to the frontend, ensure you have a middleware for sharing props on all requests via Inertia. The starter kits will have this installed as `HandleInertiaRequests` middleware. Copy the following to the `share` function in this middleware, or equivalent:

```
public function share (Requesr $request): array
{
    return [
        ...parent::share($request),
        'toast' => $request->session()->get('toast')
    ]
}
```

This will share all toast messages to your frontend under the property `toast`. To use the client library, use the plugin in the `app.js` file after installing. See the documentation for the Javascript library [here](https://github.com/jdw5/surge-toast-client#readme)

Usage
-----

[](#usage)

The package provides a global way to flash data to the session, via the structure of `ToastData`. ToastData accepts the following parameters:

```
public function __construct(
    public string $message,
    public ?string $type = ToastType::DEFAULT->value,
    public ?int $duration = self::DEFAULT_DURATION,
    public ?string $title,
    public ?mixed $custom,
) {}
```

You can call the method from a controller through the following ways

```
toast(new ToastData('A message', 'info'));

toast(ToastData::from([
    'message' => 'A message',
    'duration' => 5000,
    'title' => 'A title',
    'custom' => ['key' => 'value']
    'type' => 'info',
]));

toast([
    'message' => 'Error message',
    'type' => 'error',
    'duration' => 5000,
]);
```

Or any combination of this. This will flash a message to the session with the `type` provided, or will use the `default` type if not specified

You can also shortcut the types using the following methods:

```
toast()->info('A message');
toast()->success('A message');
toast()->error('A message');
toast()->warning('A message');
```

Which will set the type for you. You can also chain with the `duration` and `title` methods:

```
toast()->info('A message')->duration(5000)->title('A title');
```

License
-------

[](#license)

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

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

863d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/87954417?v=4)[Joshua Wallace](/maintainers/jdw5)[@jdw5](https://github.com/jdw5)

---

Top Contributors

[![jdw5](https://avatars.githubusercontent.com/u/87954417?v=4)](https://github.com/jdw5 "jdw5 (5 commits)")

---

Tags

flashtoastlaravel-toast

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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