Skip to content

antoniocambados/flash.php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flash.php

Tiny flash message library optimised for Bootstrap.

Install

Add it to your composer.json:

"mckay/flash": "^1.0.3",

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">&times;</button>
		<?= $flash['message'] ?>
	</div>
<? } Flash::clear(); ?>

License

Copyright © McKay Software
MIT License
http://mckay.mit-license.org

About

Handy flash messages.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%