mckay / flash
Handy flash messages.
Installs: 5 078
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 8
Forks: 1
Open Issues: 0
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-05-06 05:49:21 UTC
README
Tiny flash message library optimised for Bootstrap.
Install
Add it to your composer.json:
"mckay/flash": "^1.0.5",
then run $ composer update
.
Usage
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'); }
In your view
<? 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(); ?>
License
Copyright © McKay Software MIT License http://mckay.mit-license.org