PHPackages                             fotografde/notification-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. fotografde/notification-library

ActiveLibrary[Queues &amp; Workers](/categories/queues)

fotografde/notification-library
===============================

A simple library to push events events to the queue to be handled by the Notification Service

1.1.1(7y ago)039.5kPHPPHP &gt;=5.5

Since May 24Pushed 7y ago2 watchersCompare

[ Source](https://github.com/fotografde/notification-library)[ Packagist](https://packagist.org/packages/fotografde/notification-library)[ Docs](https://dev.getphoto.io/getphoto/NotificationLibrary)[ RSS](/packages/fotografde-notification-library/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/499ebca322d2d787a814944434653d9e35f10882957a4997c17287b5f1cf8a63/68747470733a2f2f7472617669732d63692e6f72672f666f746f6772616664652f6e6f74696669636174696f6e2d6c6962726172792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/fotografde/notification-library)

Notification Library
====================

[](#notification-library)

A simple library to push data to be handled by the Notification Service

Setup
-----

[](#setup)

- add to your (project folder)/composer.json

    ```
    "require": {
        ...
        "fotografde/notification-library": "*"
    }

    ```
- run

    ```
    (project folder)> composer update

    ```
- modify the configuration file, if necessary

    ```
    (project folder)> cp vendor/GetPhoto/notification-library/config/notification.php.default vendor/GetPhoto/notification-library/config/notification.php
    OR
    (project folder)> cp src/vendors/GetPhoto/notification-library/config/notification.php.default src/vendors/GetPhoto/notification-library/config/notification.php

    ```

    \*\*OR (for local configuration) \*\*

    ```
    (project folder)> cp config/notification.php.default config/notification.php

    ```
- and configure it

    ```
    'events_table' => 'EventQueue',
    'region' => '...',
    'endpoint' => '...',
    'credential_key' => '...',
    'credential_secret' => '...',
    'notification_service_url' => '...',
    'method_add_trigger' => 'api/trigger',

    ```

Events
------

[](#events)

### Usage

[](#usage)

- Import the Notification class

    ```
    use GetPhoto\Notification;
    ```
- Pass the data to the method to push events

    ```
    (new Notification)->pushEvent($data);
    ```
- Examples

    - User Login

        ```
        $data = [
            'eventTypeId' => 'User.Login',
            'dateTime' => '20170117 232900',
            'userId' => '1',
            'photographerId' => '1',
        ];
        (new Notification)->pushEvent($data);
        ```
    - New Contactsheet

        ```
        $data = [
            'eventTypeId' => 'Contactsheet.Created',
            'dateTime' => '20170115 080005',
            'userId' => '5',
            'photographerId' => '2',
            'contactsheetId' => 'a0shfd0a9shf9',
        ];
        (new Notification)->pushEvent($data);
        ```

Triggers
--------

[](#triggers)

### Usage

[](#usage-1)

- Import the Trigger class

    ```
    use GetPhoto\Trigger;
    ```
- Instantiate a new object, add the options and save

    ```
    //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();
    ```

### Samples

[](#samples)

#### Manual Trigger

[](#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.

    ```
    $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();
    ```

    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:

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Total

3

Last Release

2820d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cedb2d341babd890f792c5e187a32b3697ef0568b1ee4dfbef6d069a43ecf2f?d=identicon)[beinbm](/maintainers/beinbm)

---

Top Contributors

[![beinbm](https://avatars.githubusercontent.com/u/995872?v=4)](https://github.com/beinbm "beinbm (5 commits)")

---

Tags

eventsnotification service

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fotografde-notification-library/health.svg)

```
[![Health](https://phpackages.com/badges/fotografde-notification-library/health.svg)](https://phpackages.com/packages/fotografde-notification-library)
```

###  Alternatives

[sabre/event

sabre/event is a library for lightweight event-based programming

35227.4M25](/packages/sabre-event)[nuwber/rabbitevents

The Nuwber RabbitEvents package

120515.8k3](/packages/nuwber-rabbitevents)[palpalani/laravel-sqs-queue-json-reader

Custom SQS queue reader for Laravel

26109.8k](/packages/palpalani-laravel-sqs-queue-json-reader)[chocofamilyme/laravel-pubsub

AMQP wrapper for Laravel to publish and consume messages

1120.0k](/packages/chocofamilyme-laravel-pubsub)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
