PHPackages                             rboonzaijer/laravel-multiple-flash-messages - 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. rboonzaijer/laravel-multiple-flash-messages

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

rboonzaijer/laravel-multiple-flash-messages
===========================================

Multiple flash messages with Laravel

1.1.2(2y ago)21.8kMITPHPPHP ^8.0

Since Jan 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/rboonzaijer/laravel-multiple-flash-messages)[ Packagist](https://packagist.org/packages/rboonzaijer/laravel-multiple-flash-messages)[ Docs](https://github.com/rboonzaijer/laravel-multiple-flash-messages)[ RSS](/packages/rboonzaijer-laravel-multiple-flash-messages/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

Laravel Multiple Flash Messages
===============================

[](#laravel-multiple-flash-messages)

[![Latest Version on Packagist](https://camo.githubusercontent.com/22f1582564e3f07a88f6b706c3c5ac173869a7388dbc1c55a08d68669664325c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72626f6f6e7a61696a65722f6c61726176656c2d6d756c7469706c652d666c6173682d6d657373616765732e7376673f7374796c653d666c6174)](https://packagist.org/packages/rboonzaijer/laravel-multiple-flash-messages)[![MIT License](https://camo.githubusercontent.com/6a35fbae3027cd91e72a80c82f48815ca55d9b9adba3b2d8cd3308b31b73147b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72626f6f6e7a61696a65722f6c61726176656c2d6d756c7469706c652d666c6173682d6d657373616765733f7374796c653d666c6174)](https://github.com/rboonzaijer/laravel-multiple-flash-messages/blob/main/LICENSE.md)

[![tests](https://github.com/rboonzaijer/laravel-multiple-flash-messages/actions/workflows/tests.yml/badge.svg)](https://github.com/rboonzaijer/laravel-multiple-flash-messages/actions/workflows/tests.yml)[![tests](https://camo.githubusercontent.com/2abbba9fed62d5993f4fd54bcea2905d439480ca446b6a9c51e816b45570925f/68747470733a2f2f736869656c64732e696f2f62616467652f7374796c652d382e332d677265656e3f6c6162656c3d706870267374796c653d666c6174)](https://github.com/rboonzaijer/laravel-multiple-flash-messages/actions/workflows/tests.yml)[![tests](https://camo.githubusercontent.com/1eccc19f4af4b1d8c9618014eba10be27b842381716f867c33a88e20752ad042/68747470733a2f2f736869656c64732e696f2f62616467652f7374796c652d382e322d677265656e3f6c6162656c3d706870267374796c653d666c6174)](https://github.com/rboonzaijer/laravel-multiple-flash-messages/actions/workflows/tests.yml)[![tests](https://camo.githubusercontent.com/bb996f2792f1a562c0bf05f4994c9fca6c4f1abb9ed350cb61fcc4d84112e46a/68747470733a2f2f736869656c64732e696f2f62616467652f7374796c652d382e312d677265656e3f6c6162656c3d706870267374796c653d666c6174)](https://github.com/rboonzaijer/laravel-multiple-flash-messages/actions/workflows/tests.yml)

- Supports flashing **multiple messages** to the session
- **Flexible messages** - fill the `$options` array with your custom data
- Helper methods that can easily be remembered and allows **clean controllers**
- **Inertia + Vue** implementation example included below
- Automated tests running on Laravel 10

Install
-------

[](#install)

```
composer require rboonzaijer/laravel-multiple-flash-messages:^1.0
```

Usage
-----

[](#usage)

```
class UserController
{
    public function store()
    {
        // ...

        flash('User created');

        flashWarning('User has no permissions yet');

        return to_route(...);
    }
```

Blade view example
------------------

[](#blade-view-example)

```
{{-- /resources/views/layouts/app.blade.php --}}

@include('partials.flash-messages.container')
```

```
{{-- /resources/views/partials/flash-messages/container.blade.php --}}

@if(session()->has('messages'))

        @foreach(session()->get('messages') as $index => $message)
            @include('partials.flash-messages.message', [
                'index' => $index,
                'message' => $message
            ])
        @endforeach

@endif
```

```
{{-- /resources/views/partials/flash-messages/message.blade.php --}}

    {{ $message['message'] }}

```

Flexible - Use your own message types and custom data
-----------------------------------------------------

[](#flexible---use-your-own-message-types-and-custom-data)

```
flash('Flagged', [
    'type' => 'danger-flagged',
    'description' => 'You have been flagged for creating to many users',
    'details' => [
        'ticket' => 123,
        'urls' => [
            'https://example.com',
            'http://example.com',
        ]
    ]
]);
```

```
{{-- /resources/views/partials/flash-messages/message.blade.php --}}

        {{ $message['message'] }}

        @if(isset($message['details']['ticket']))
            - Ticket #{{ $message['details']['ticket'] }}
        @endif

    @if(isset($message['description']))

            {{ $message['description'] }}

    @endif

    @if(isset($message['details']['urls']))

            @foreach($message['details']['urls'] as $index => $url)

                        {{ $url }}

            @endforeach

    @endif

```

Helper methods
--------------

[](#helper-methods)

These helper methods are available and they all use the same arguments.

- @param string $message ( required ) - Contains the message
- @param array $options ( default = \[ \] ) - add additional info in the array
- @param boolean $flashToSession ( default = true ) - for special use cases (see below)

```
flash($message, $options, $flashToSession);
flashInfo($message, $options, $flashToSession);
flashSuccess($message, $options, $flashToSession);
flashWarning($message, $options, $flashToSession);
flashError($message, $options, $flashToSession);
```

Manually flash to the session
-----------------------------

[](#manually-flash-to-the-session)

This can be used if you want to send the messages only if a certain condition is met, for example:

```
flash('Saved', [], Auth::user()->hasNotificationsEnabled());
```

or

```
flash('Saved', [], false);

// ...

if(Auth::user()->hasNotificationsEnabled()) {
    flashMessagesToSession();
}
```

Inertia + Vue + Tailwind + DaisyUI example
------------------------------------------

[](#inertia--vue--tailwind--daisyui-example)

-
-
-
-

```
// app/Http/Middleware/HandleInertiaRequests.php

public function share(Request $request): array
{
    return array_merge(parent::share($request), [
        'messages' => fn () => session()->get('messages'),
    ]);
}
```

```

/* /resources/js/Shared/Layout.vue */

import FlashMessages  from '../Shared/FlashMessages.vue';

```

```

            {{ message['message'] }}

            x

```

```
/* tailwind.config.js */
/* Don't forget to set a safelist for classes that should always be available */

safelist: [
    'toast',
    'toast-top',
    'toast-end',
    'alert',
    'alert-info',
    'alert-success',
    'alert-warning',
    'alert-error',
],
```

Testing
-------

[](#testing)

```
composer run test

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

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

5

Last Release

843d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3bff536018fb2e6d1e58bf34f5fa8f658f56e7b35574ea8a0b904b21ae3cf352?d=identicon)[rboonzaijer](/maintainers/rboonzaijer)

---

Top Contributors

[![rboonzaijer](https://avatars.githubusercontent.com/u/10514742?v=4)](https://github.com/rboonzaijer "rboonzaijer (9 commits)")

---

Tags

alertsflash-messageslaravel-alertslaravel-flash-messageslaravel-multiple-alertslaravel-multiple-flash-messageslaravel-multiple-notificationslaravel-notificationsnotificationsnotificationsalertsflash-messageslaravel-notificationslaravel-multiple-flash-messageslaravel-flash-messageslaravel-multiple-notificationslaravel-multiple-alertslaravel-alerts

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rboonzaijer-laravel-multiple-flash-messages/health.svg)

```
[![Health](https://phpackages.com/badges/rboonzaijer-laravel-multiple-flash-messages/health.svg)](https://phpackages.com/packages/rboonzaijer-laravel-multiple-flash-messages)
```

###  Alternatives

[arcanedev/notify

Flexible flash notifications helper for Laravel.

139.5k1](/packages/arcanedev-notify)

PHPackages © 2026

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