Tiny flash message library optimised for Bootstrap.
Add it to your composer.json:
"mckay/flash": "^1.0.3",then run $ composer update.
use \McKay\Flash;
Flash::info('Welcome home!');
if ($user->isNearACliff()) {
Flash::warning('Careful, there');
}
$user->takeARandomStep();
Flash::debug('Uh oh?');
if ($user->heartbeat > 0) {
Flash::success('Ok');
} else {
Flash::error('Call an ambulance');
}<? foreach(Flash::all() as $flash) { ?>
<div class="alert alert-<?= $flash['type'] == 'error' ? 'danger' : $flash['type'] ?>">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?= $flash['message'] ?>
</div>
<? } Flash::clear(); ?>Copyright © McKay Software
MIT License
http://mckay.mit-license.org