PHP code example of dotkernel / dot-flashmessenger

1. Go to this page and download the library: Download dotkernel/dot-flashmessenger 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/ */

    

dotkernel / dot-flashmessenger example snippets


return [
    'dot_flashmessenger' => [
        'namespace' => 'flash messages session namespace name'
    ],
];

$container->get(FlashMessengerInterface::class);

$this->flashMessenger->addMessage('error', 'This is a error flash message');
//on the next request you can get all messages from a namespace, or all messages from all namespaces if namespace is omitted
$this->flashMessenger->getMessages('error');

$this->flashMessenger->addData('myData', $someData);
// next request
$this->flashMessenger->getData('myData');

FlashMessengerInterface::ERROR_NAMESPACE
FlashMessengerInterface::WARNING_NAMESPACE 
FlashMessengerInterface::INFO_NAMESPACE 
FlashMessengerInterface::SUCCESS_NAMESPACE

/**
 * @param string $error
 * @return void
 */
public function addError($error);

/**
 * @param string $info
 * @return void
 */
public function addInfo($info);

/**
 * @param string $warning
 * @return void
 */
public function addWarning($warning);

/**
 * @param string $success
 * @return void
 */
public function addSuccess($success);

Dot\FlashMessenger\FlashMessengerInterface::class

Dot\FlashMessenger\View\RendererInterface::class