Download the PHP package paaa14/c-flash-message without Composer

On this page you can find all versions of the php package paaa14/c-flash-message. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package c-flash-message

CFlashMessage

build:passed Scrut CodeCoverage

This is an module for simple flash-messages. It contains in general three functions:

setFlash('type', 'message'): Types allowed: success, notice, warning and error.

hasFlash(): Returns true if flash is set, else false.

getFlash(): Get flashMessage.

How to use CFlashMessage

1. Install via composer

Install CFlashMessage via packagist and composer. Add

"require": {
    "php": ">=5.4",
    "paaa14/c-flash-message" : "dev-master"
},

in your composer.json.

2. Set FlashMessage-class

Set flashMessage in your base class implementing Dependency Injection / Service Locator- file. If you are using Anax-MVC, ex.

File:src/DI/CDIFactoryDefault.php

Add $this->setShared('flashMessage', '\Anax\FlashMessage\CFlashMessage') (you maybe want to change the namespace for CFlashMessage.php)

3. Implement code in your template-file

File: theme/anax-base/index.tpl.php

In your div#main, put code:

    <div class="<?=$message['type']?>"><?=$message['message']?></div>

to see if flash has been set. If it returns true, show flashMessage.

Exemple:

<div id='main'>

    <div class="<?=$message['type']?>"><?=$message['message']?></div>

</div>

4. Add stylesheet

Copy flash.css to your css-archive and be sure that flash.css is activated in your framework.

5. Session

Be sure that Sessions is activated in your framework. If you var_dump($_SESSION) you should have an empty session. If you are using Anax-MVC you might have to start the session manually i your frontcontroller.

Put $app->session() in the top of your controller, after you assign $app

6. Router

Make sure your framework handles routes. If you are using Anax-MVC, put $app->router->handle() in the bottom of your frontcontroller, before it's being sent to render.

7. Create routes and use FlashMessage

Exemple in Anax-MVC:

$app->router->add('', function() use ($app) {
    $app->flashMessage->setFlash('success', "Success! Update page to make this message disappear.");
    $app->views->addString('Flash is set, click on the link to view the flash', 'main');  
    $app->views->addString("<a href='" . $app->url->create('flash') . "'>Link</a>", 'main');
});

$app->router->add('flash', function() use($app) {
    $app->views->addString('In your template-file, there is a if-statement that checks if a flash has been set. If it returns TRUE, this message is shown. Update page to remove this message.');
});

To get Anax-MVC, visit: https://github.com/mosbth/Anax-MVC

Enjoy :)


All versions of c-flash-message with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package paaa14/c-flash-message contains the following files

Loading the files please wait ....