PHPackages                             zaichaopan/flash - 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. zaichaopan/flash

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

zaichaopan/flash
================

A simple package to make flash message more flexible

v0.1-beta(7y ago)01MITPHPPHP &gt;=7.1.0

Since Jun 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/zaichaopan/flash)[ Packagist](https://packagist.org/packages/zaichaopan/flash)[ RSS](/packages/zaichaopan-flash/feed)WikiDiscussions master Synced 2mo ago

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

Flash
=====

[](#flash)

This package makes Laravel flash message more flexible. It can be used in laravel 5.5 or higher.

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

[](#installation)

```
composer require zaichaopan/flash
```

Usage
-----

[](#usage)

In laravel, you can flash message like below

```
$request->session()->flash($key, $message);
```

Or you can use the **with** method when redirect

```
// in your controller action method
return redirect()->with($key, $message);

// or take advantage of dynamically binding
return redirect()->withSuccess($message); // or withError, withWarning, ...
```

But the problem is when it comes to showing flash message in blade, your flash message may have different keys (e.g. error, success, ...). You have to check all the possible keys to determine if you have flash message to show in the blade. This package can be used to make things easier.

- To flash a message

This packages provides a global helper method **flash** to create a Flash instance. After you create the Flash instance, there are five available methods you can call to generate five different types of flash messages. Each method takes two parameters: **message** and **options.**

**The first one is required** which is used to set the message body of the flash. **The second one is an array and it is optional.** It is used to add addition data to the flash.

```
// generate a general info message
flash()->info($message, $options) ;

// generate a success message
flash()->success($message, $options);

// generate a warning message
flash()->warning($message, $options);

// generate a danger message
flash()->danger($message, $options);

// generate an error message
flash()->error($message, $options);
```

- Check whether flash exists:

```

@if (flash()->ready())

@endif
```

- Get flash type:

```
flash()->type();
```

- Get flash message

```
flash()->message();
```

- Get additional option data

```
flash()->options();
```

- Pass data to javascript

In real life, you may want to create a flash component in vue, which can be used to display the flash message from the server or from the js. To do that, let's say you have a component called **Flash.vue** and there is a property called **flash** inside it.

```

```

Now if there is no flash, the value of the **flash** property will be null. If there is a flash message, the value will be an object contains properties: **message, type, options.**

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

2879d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5dfb2782ff22c81ce8095946983c3d437156ed09b132ec93727da68a14fa7db0?d=identicon)[zaichaopan](/maintainers/zaichaopan)

---

Top Contributors

[![zaichaopan](https://avatars.githubusercontent.com/u/16104572?v=4)](https://github.com/zaichaopan "zaichaopan (7 commits)")

---

Tags

flashlaravelphplaravelflash

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zaichaopan-flash/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[caffeinated/flash

Flash Messages for Laravel

4649.5k2](/packages/caffeinated-flash)[cartalyst/alerts

Alerts allows you to easily pass alert messages to your Laravel views.

3064.2k](/packages/cartalyst-alerts)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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