PHP code example of germania-kg / flashmessages

1. Go to this page and download the library: Download germania-kg/flashmessages library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

germania-kg / flashmessages example snippets



use Pimple\Container;
use Slim\Flash\Messages;
use Germania\FlashMessages\FlashMessagesServiceProvider;

// 'Slim Flash Messages' object is optional
$flash_services = new FlashMessagesServiceProvider;
$flash_services = new FlashMessagesServiceProvider( new Messages );

// Setup Pimple container
$container = new Container;
$container->register( $flash_services );

// Shortest Setup:
$container->register( new FlashMessagesServiceProvider );

$flash_setter = $container['FlashMessages.Setter'];
$flash_setter( $keyword, $message );

$flash_getter = $container['FlashMessages.Getter'];

//  Get one single message. 
$flash_getter( $keyword );

//  $keyword is optional; leave empty to get ALL messages
$flash_getter();