PHPackages                             artbyrab/phlash - 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. artbyrab/phlash

ActivePackage

artbyrab/phlash
===============

A very simple PHP flash messages library.

013PHP

Since Jan 3Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Phlash
======

[](#phlash)

[![Image](files/graphics/phlash-logo-small.png?raw=true)](files/graphics/phlash-logo-small.png?raw=true)

Phlash is a very simple PHP flash messages library. Phlash does not define how your flash messages look or whether you use javascript to close them or not. Instead, Phlash just provides the very raw tools to quickly add and get flash messages.

Requirements
------------

[](#requirements)

- PHP 5.6+

Features
--------

[](#features)

- Flash messages
    - Add one or more flash messages with a type
        - Define your own types like warning, info, danger or anything you desire
    - Get
        - Get your flash messages to show in a view
        - Render any way you like including choosing your own div layouts and naming conventions
    - Clear
        - Clear the flash messages after they have been shown

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

[](#installation)

The reccomended way to install is via Composer.

Ensure your minimum-stability is set to dev:

```
$ composer require artbyrab/phlash
```

or add it to your composer.json file:

```
"artbyrab/phlash": "master@dev"
```

Usage
-----

[](#usage)

Ensure your view or entry script has php sessions activated:

```
session_start();
```

Add one or more flash messages in your controller action or file:

```
use artbyrab\phlash\Phlash;

Phlash::add("info", "This is Phlash!");
Phlash::add("success", "Your message was successful!");
Phlash::add("warning", "Be careful though, using Phlash can be addictive!");
Phlash::add("danger", "See it's hard to stop!");
```

Add a way to render the flash messages in your view/layout or file. Please note the below is just an example of how you can render your flash messages, you don't need to use the below format:

```
