dev-master
9999999-dev https://github.com/drewpereli/flasherFlash messages for php
MIT
by Drew Pereli
Wallogit.com
2017 © Pedro Peláez
Flash messages for php
This is a very small package that makes it easy to implement flash message., (*1)
Install with composer., (*2)
composer require drewpereli/flasher
Or download the source from github., (*3)
Flasher is super easy to use! On any php file you'd like to use flahser in, include it by requiring the composer autoloader., (*4)
require_once "path/to/vendor/autoload.php";
If you're not using composer, simply include or require the file "flasher.php" in any file that uses the flasher., (*5)
require_once "path/to/flasher/flasher.php";
To set and get flash messages, create a new flasher object., (*6)
$flasher = new Flasher();
You can create a new flasher object at the top of each file that needs the flasher. The new object will have access to any flash messages set by any other existing or previous flasher object., (*7)
Set messages like this:, (*8)
$flasher->set("message type", "your message here!"); //Sets message of type "message type" to "your message here".
Get messages like this:, (*9)
$flasher->get("message type"); //Returns message of type "message type" (if there is one), and unsets it.
As soon as you "get" a message, it will be removed., (*10)
You can also use magic methods!, (*11)
$flasher->message_type = "your message here!"; $message = $flasher->message_type; //"Your message here!" $message = $flasher->message_type; //null
Flash messages for php
MIT