PHP code example of sebkay / noticeable

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

    

sebkay / noticeable example snippets


session_start();



use Noticeable\Notice;
use Noticeable\NoticeContent;

Notice::set(
    new NoticeContent('Please enter an email address.', 'error')
);

$notice = Notice::get();

print_r($notice);

// Will return
Noticeable\NoticeContent Object
(
    [message:protected] => Please enter an email address.
    [type:protected] => error
    [allowed_types:protected] => Array
        (
            [0] => info
            [1] => success
            [2] => error
        )

)


$notice = Notice::get();

$notice->message(); // (string) Please enter an email address.

$notice->type(); // (string) error


$notice = Notice::get();

echo $twig->render('notice.twig', [
    'message' => $notice->message(),
    'type'    => $notice->type()
]);