PHP code example of ilyaserdyuk / notices

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

    

ilyaserdyuk / notices example snippets


class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        $this->notices()->addSuccessMessage('You successfully read this important alert message.');
        $this->notices()->addInfoMessage('This alert needs your attention, but it\'s not super important.');
        $this->notices()->addWarningMessage('Better check yourself, you\'re not looking too good.');
        $this->notices()->addErrorMessage('Change a few things up and try submitting again.');
    }
}

return [
    'view_helper_config' => [
        'notices' => [
            'auto_escape' => true,
            'template_string' => '<div class="alert alert-{class} alert-dismissible" role="alert">{text}</div>',
            'label_for_status' => [
                Message::CLASS_SUCCESS => 'Успешно:',
                Message::CLASS_INFO => 'Информация:',
                Message::CLASS_WARNING => 'Предупреждение:',
                Message::CLASS_ERROR => 'Ошибка:',
            ],
        ],
    ],
];
html
<?= $this->notices()