PHP code example of awesome9 / notifications

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

    

awesome9 / notifications example snippets


Awesome9\Notifications\Center::get()
	->set_storage( 'awesome9_plugin_notifications' );  // Option name to be save persistent notifications in DB.

// This notification shows once its a temporary notification.
Awesome9\Notifications\Center::get()
	->add( 'Your message goes here.', array(
		'id'      => 'awesome9_some_id'
		'type'    => \Awesome9\Notifications\Notification::ERROR,
		'screen'  => 'post',
		'classes' => 'style-me-custom'
	) );

// Now let's add a persistent one which is dismissible by user.
Awesome9\Notifications\Center::get()
	->add( 'Your message goes here.', array(
		'id'         => 'awesome9_some_id_2'
		'type'       => \Awesome9\Notifications\Notification::ERROR,
		'persistent' => 'some_unique_Id',
		'screen'     => 'post',
		'classes'    => 'style-me-custom'
	) );

// Let's remove a notification.
Awesome9\Notifications\Center::get()
	->remove( 'awesome9_some_id' )

Awesome9\Notifications\add( $message, $options = array() );

Awesome9\Notifications\remove( $notification_id );