Booby part of Monolyth

Full documentationAPI referenceAll releases and notes

Latest release

1.2.1

Date: github

README.md


Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 215

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 217

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 511

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 511

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 518

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 552

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 552

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 567

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 568

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 667

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 677

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 677

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 686

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 687

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 1074

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php on line 1469

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/Markdown.php on line 955

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/Markdown.php on line 1361

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/Markdown.php on line 1386

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/Markdown.php on line 1799

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/sensi/sites/monomelodies/vendor/michelf/php-markdown/Michelf/Markdown.php on line 1801

Generic flash message storage system

"Flash messages" are those one-off messages a web application might want to show to a User, e.g. "Changes saved successfully". The developer wants to add these messages and be ensured they get shown exactly once, whenever (between page loads, after redirect, on the desktop when generated in an Ajax request etc.).

Installation

Composer (recommended)

$ composer require monolyth/booby

Manual

  1. Clone or download the repository;
  2. Add /path/to/booby/src for namespace Monolyth\Booby in your autoloader.

Usage

Adding a message is simple:

<?php

Monolyth\Booby\Flash::me('This is my awesome message.');

...as is later displaying it:

<?php

foreach (Monolyth\Booby\Flash::each() as $msg) {
    echo $msg;
}

Adding options to messages

You can pass an optional second parameter to Flash::me containing a hash of key/value pairs available as options on your message. E.g.:

<?php

Monolyth\Booby\Flash::me('This is a warning', ['type' => 'warning']);

$msg = Monolyth\Booby\Flash::each();
echo $msg->type; // "warning"

These options can be anything as long as the key is a valid PHP property name.