This is an easy-to-use php component for working with flash messages in your project. It uses $_SESSION
to store messages. Because of it you have to use session_start()
at the begining of your script. See index.php
for example.
exists()
- check existing a message by its typesetFlash()
- set a flash messagegetFlash()
- return the added message
include __DIR__ . '/Flash/Flash.php';
Flash::setFlash('Error message.');
Flash::setFlash('Some information.', 'info');
Flash::setFlash('Job is done!', 'success');
Flash::setFlash('Additional error message.', 'danger', false);
echo Flash::getFlash('info');
echo Flash::getFlash('danger');
echo Flash::getFlash('success');