PHP code example of webiny / notification-manager

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

    

webiny / notification-manager example snippets


/* @var NotificationManager $nm */
$nm = $this->wService('NotificationManager');
$notification = $nm->getNotification('test');

$file = new File('webiny.json', $this->wStorage('YourStorage'));
$notification->addAttachment($file, 'custom.json', 'application/json');

// the recipient needs to be instance of Recipients\Email, based on that notification manager know what type of notification to send
$recipient = new \Apps\NotificationManager\Php\Lib\Recipients\Email('[email protected]', 'ClientName');
$notification->setRecipient($recipient);
$notification->send();