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 the 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

public function addError(string|array $error);

public function addInfo(string|array $info);

public function addWarning(string|array $warning);

public function addSuccess(string|array $success);

Dot\FlashMessenger\FlashMessengerInterface::class

Dot\FlashMessenger\View\RendererInterface::class