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

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

ajani/flash-message
===================

A simple package to allow usage of flash messages using session.

v2.1(6y ago)13.5kGPL-3.0-or-laterPHPPHP &gt;=7.0.0

Since Nov 9Pushed 6y ago2 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (0)

flash-message
=============

[](#flash-message)

A simple package to allow usage of flash messages using session. Totaly framework and template agnostic.

Install
=======

[](#install)

To install this package

```
composer require ajani/flash-message

```

Usage
=====

[](#usage)

FlashMessage is KISS oriented. It only offer two major functionnalities :

- Writing a new flash message in session.
- Reading and remove a flash message from session.

To use FlashMessage, include `autoload.php` from Composer, and use `use \FlashMessage\FlashMessage`. No need to instanciate class `FlashMessage` as it's a static class.

***Make sure you have enabled session before using FlashMessage or nothing will happen***

Store a flash message :
-----------------------

[](#store-a-flash-message-)

When you want to store a flash message, call the method `push($type, $text)` and pass it the `$type` of the message (usually a short string, like `error`, `info`, `success` or `danger`) and the `$text` of the message.

```
