2017 © Pedro Peláez
 

library flash

A small flash module for Anax-MVC

image

olund/flash

A small flash module for Anax-MVC

  • Thursday, May 15, 2014
  • by Olund
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Flash

Scrutinizer Code Quality Build Status Code Coverage You can also find this on Packagist, (*1)

 _____ _           _
|  ___| | __ _ ___| |__
| |_  | |/ _` / __| '_ \
|  _| | | (_| \__ \ | | |
|_|   |_|\__,_|___/_| |_|

A small PHP Flash module for Anax-MVC based on sessions., (*2)

Preview

alt tag, (*3)

Instructions for Anax-MVC

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 message
Success message
Notice message
Warning message

The Versions

15/05 2014

dev-master

9999999-dev http://x80.se

A small flash module for Anax-MVC

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php mvc anax flash olund