dev-master
9999999-dev http://x80.seA small flash module for Anax-MVC
MIT
The Requires
- php >=5.4
by Henrik Ölund
php mvc anax flash olund
Wallogit.com
2017 © Pedro Peláez
A small flash module for Anax-MVC
You can also find this on Packagist, (*1)
_____ _ _ | ___| | __ _ ___| |__ | |_ | |/ _` / __| '_ \ | _| | | (_| \__ \ | | | |_| |_|\__,_|___/_| |_|
A small PHP Flash module for Anax-MVC based on sessions., (*2)
, (*3)
Add the following to your frontcontroller., (*4)
// Start session.
$app->withSession();
// Set flash as a shared service.
$di->setShared('flash', function () {
$flash = new \Anax\Flash\CFlash();
return $flash;
});
You can now use Flash, (*5)
$app->flash->success('Success message');
$app->flash->error('Error message');
$app->flash->notice('Notice message');
$app->flash->warning('Warning message');
To get the html use:, (*6)
$app->flash->get()
Example:, (*7)
// Create a route.
$app->router->add('flash', function () use ($app) {
// Sets the title
$app->theme->setTitle('Flash');
// Add some flash messages
$app->flash->success('This is a success message');
$app->flash->error('Error message');
$app->flash->notice('Notice message');
$app->flash->warning('Warning message');
$app->flash->success('Success again');
// Call the flash->get() method.
$app->views->addString($app->flash->get(), 'main');
// Use $app->flash->get(false) if you dont have FontAwesome.
});
The output:, (*8)
Error messageSuccess messageNotice messageWarning message
A small flash module for Anax-MVC
MIT
php mvc anax flash olund