PHP code example of fotografde / notification-library
1. Go to this page and download the library: Download fotografde/notification-library 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/ */
fotografde / notification-library example snippets
//Trigger ID => Unique name for your trigger
//Trigger type => EventBased, Scheduled, TimeBased or Manual
//Trigger action => Action to be executed
$trigger = new Trigger('trigger id', 'trigger description', 'trigger type', 'trigger action');
//optional methods
$trigger->addSubscriptionKey('value');
$trigger->addDelay('value');
$trigger->addWhen('value');
//auxiliar methods
$trigger->createActionParameterConstant('constant', 'value');
$trigger->createActionParameterVariable('variable', 'value');
$trigger->createActionParameterMethod('variable', 'method', ['arguments', ...]);
//optional methods that can be used multiple times
$trigger->addActionParameter($parameter);
$trigger->addParameter(['data key' => 'data value', ...]);
$trigger->save();
$trigger = new Trigger('UserLogins.v1', 'Shows all logins from an user', 'Manual', 'method::returnJson');
$trigger->addSubscriptionKey('UserId');
$userId = $trigger->createVariable('userId', 'userId');
$eventTypeId = $trigger->createConstant('eventTypeId', 'User.Login');
$eventsMethod = $trigger->createMethod('returnJson', [$userId, $eventTypeId]);
$events = $trigger->createVariable('events', $eventsMethod);
$trigger->addActionParameter($events);
$trigger->save();