Download the PHP package fotografde/notification-library without Composer
On this page you can find all versions of the php package fotografde/notification-library. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fotografde/notification-library
More information about fotografde/notification-library
Files in fotografde/notification-library
Package notification-library
Short Description A simple library to push events events to the queue to be handled by the Notification Service
License
Homepage https://dev.getphoto.io/getphoto/NotificationLibrary
Informations about the package notification-library
Notification Library
A simple library to push data to be handled by the Notification Service
Setup
-
add to your (project folder)/composer.json
-
run
-
modify the configuration file, if necessary
OR (for local configuration)
- and configure it
Events
Usage
-
Import the Notification class
-
Pass the data to the method to push events
-
Examples
-
User Login
- New Contactsheet
-
Triggers
Usage
-
Import the Trigger class
- Instantiate a new object, add the options and save
Samples
Manual Trigger
Triggers that are executed via api request
-
Return a json with all login from an user
Problem: We need a trigger to feed the user's config page with all of his logins. The config page will make an api request whenever the user request the login data.
Solution: We have the method returnEvents which filter events based on given arguments. In this case, we want to filter by EventTypeId and UserId. We can obtain the UserId from the subscription, so it is a variable. Since we already know the EventTypeId, we define a constant.
Result:
- Trigger ID: UserLogins.v1
- Trigger Description: Shows all logins from an user
- Type: Manual
- Subscription Key: UserId
- Action: method::returnJson
- Action Parameters: events::{{returnEvents||userId::[[userId]]||eventTypeId::User.Login}}
Usage:
http://notification-service-url/queryEvents/UserLogins.v1/subscriber-id