PHP code example of webtorque / silverstripe-notifications
1. Go to this page and download the library: Download webtorque/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/ */
webtorque / silverstripe-notifications example snippets
$service = Injector::inst()->get('NotificationService');
$deliveries = $service->send(
'RegistrationApproval', # Notification type system name.
['extra' => 'Data to inject in the message'], # Abritary data to inject in the NotificationParser.
Member::currentUser(), # User who should receive the notification.
'/notification/call-to-action-url' # Optional Call-to-Action URL.
);
# List of NotificationFailureException for providers who failed to deliver the notification.
$deliveries->getFailures();
# List of response from providers delivered their notification as expected.
$deliveries->getDeliveries();