ezon/flashmessage

Message controller for ANAX-MVC

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

pkg:composer/ezon/flashmessage

v1.0 2015-11-08 20:57 UTC

This package is not auto-updated.

Last update: 2025-12-25 01:59:17 UTC


README

Scrutinizer Code Quality Code Coverage Build Status Build Status

FlashMessageControl

Hello there,

This is a result of a lesson in a school project.

Flash messages are used to inform the user about the state of the action he / she has made or simply displaying information to users. These types of messages can be generated using this component. Below you will find some examples of instant messaging with Font Awesome.

You can easily remove or add your own messages, but you must specify them in the flashmessages.css. This version is also used with Font Awesome which you can download via https://fortawesome.github.io/Font-Awesome/.

#Installation

  1. To install, I recommend composer.
  2. Add this line into composer.json file: "require": {"ezon/flashmessage": "dev-master"}

#Access the controller in your frontcontroller:

$di->setShared('flashMessages', function() use ($di){ $flashMessages = new Ezon\FlashMessage\FlashController($di); return $flashMessages; });

In the router you also need to add the css-stylesheet flashmessages.css. Make sure that the name in the css corresponds to the name in the addMessage function if you decide to add a new message.

#Add the route in your front controller:

// Test Route $app->router->add('', function() use ($app) {

$app->theme->setTitle("Flash messages");
$app->theme->addStylesheet('css/flashmessages.css');
$app->flashMessages->addMessage('<i class="fa fa-check"></i> CHECK!', 'success');
$app->flashMessages->addMessage('<i class="fa fa-info"></i> Information', 'info');
$app->flashMessages->addMessage('<i class="fa fa-exclamation-triangle"></i> Warning!', 'warning');
$app->flashMessages->addMessage('<i class="fa fa-exclamation-circle"></i> Something went wrong!', 'error');

//Adds the view to display the messages

$app->views->add('flash/flash', [ 'content' => $app->flashMessages->getFlashMessages(), ]);

});

Good luck! :)