PHP code example of sheadawson / silverstripe-notifications

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

    

sheadawson / silverstripe-notifications example snippets


use Symbiote\Notifications\Model\NotifiedOn;

class MyDataObject extends DataObject implements NotifiedOn {
	...

/**
 * Return a list of available keywords in the format 
 * array('keyword' => 'A description') to help users format notification fields
 * @return array
 */
public function getAvailableKeywords();

/**
 * Gets an associative array of data that can be accessed in
 * notification fields and templates 
 * @return array
 */
public function getNotificationTemplateData();

/**
 * Gets the list of recipients for a given notification event, based on this object's 
 * state. 
 * $event The identifier of the event that triggered this notification
 * @return array An array of Member objects
 */
public function getRecipients($event);

use Symbiote\Notifications\Service\NotificationService;

singleton(NotificationService::class)->notify('NOTIFICATION_IDENTIFIER', $contextObject);