PHPackages                             keboola/notification-api-php-client - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. keboola/notification-api-php-client

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

keboola/notification-api-php-client
===================================

Client for Notification API

4.1.0(10mo ago)07.0k↑33.3%2MITPHPPHP ^8.2

Since Jul 7Pushed 10mo ago15 watchersCompare

[ Source](https://github.com/keboola/notification-api-php-client)[ Packagist](https://packagist.org/packages/keboola/notification-api-php-client)[ RSS](/packages/keboola-notification-api-php-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (20)Used By (2)

Notification API PHP Client [![Build Status](https://camo.githubusercontent.com/8b578c9bf4715de0359bf975ed94c3d4caa72b012aa22a1a1075c311dc7e288e/68747470733a2f2f6465762e617a7572652e636f6d2f6b65626f6f6c612d6465762f6e6f74696669636174696f6e2d6170692d7068702d636c69656e742f5f617069732f6275696c642f7374617475732f6b65626f6f6c612e6e6f74696669636174696f6e2d6170692d7068702d636c69656e743f6272616e63684e616d653d6d61696e)](https://dev.azure.com/keboola-dev/notification-api-php-client/_build/latest?definitionId=82&branchName=main)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#notification-api-php-client-)

PHP client for the Notification API ([API docs](https://app.swaggerhub.com/apis/odinuv/notifications-service/1.0.0)).

Usage
-----

[](#usage)

The client uses two kinds of authorizations - Storage API token for Subscription API (`SubscriptionClient` class) and Manage API Application token with scopes:

- `notifications:push-event` for the Events API (`EventsClient` class)
- `notifications:send-notification` for the Notifications API (`NotificationsClient` class)

```
composer require keboola/notification-api-php-client
```

```
use Keboola\NotificationClient\EventsClient;
use Keboola\NotificationClient\Requests\PostEvent\JobFailedEventData;
use Keboola\NotificationClient\Requests\PostEvent\JobData;
use Keboola\NotificationClient\Requests\Event;
use Psr\Log\NullLogger;

$client = new EventsClient(
    new NullLogger(),
    'http://notifications.connection.keboola.com/',
    'xxx-xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
);
$client->postEvent(
    new Event(
        new JobFailedEventData(
            '123',
            'My Project',
            'Job finished with error',
            new JobData('my-project', '123', 'http://someUrl', '2020-01-02', '2020-01-01', 'my-orchestration')
        )
    )
);
```

or use a factory to create the client

```
use Keboola\NotificationClient\ClientFactory;

$clientFactory = new ClientFactory('https://connection.keboola.com');
$clientFactory->getEventsClient('xxx-xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
```

Development
-----------

[](#development)

- Create an Azure service principal to download the required images and login:

    ```
        SERVICE_PRINCIPAL_NAME=[USERNAME]-notification-api-pull
        ACR_REGISTRY_ID=$(az acr show --name keboolapes --query id --output tsv --subscription c5182964-8dca-42c8-a77a-fa2a3c6946ea)
        SP_PASSWORD=$(az ad sp create-for-rbac --name http://$SERVICE_PRINCIPAL_NAME --scopes $ACR_REGISTRY_ID --role acrpull --query password --output tsv)
        SP_APP_ID=$(az ad sp show --id http://$SERVICE_PRINCIPAL_NAME --query appId --output tsv)
    ```
- Login and check that you can pull the image:

    ```
        docker login keboolapes.azurecr.io --username $SP_APP_ID --password $SP_PASSWORD
        docker pull keboolapes.azurecr.io/notification-service:latest
    ```
- Add the credentials to the k8s cluster:

    ```
        kubectl create secret docker-registry regcred --docker-server="https://keboolapes.azurecr.io" --docker-username="$SP_APP_ID" --docker-password="$SP_PASSWORD" --namespace dev-notification-client
        kubectl patch serviceaccount default -p "{\"imagePullSecrets\":[{\"name\":\"regcred\"}]}" --namespace dev-notification-client
    ```
- Set the following environment variables in `set-env.sh` file (use `set-env.template.sh` as sample):

    - `HOSTNAME_SUFFIX` - Suffix for the hostname, e.g. `eu-west-1.aws.keboola.dev`.
    - `TEST_STORAGE_API_TOKEN` - Token to a test project.
    - `TEST_STORAGE_API_PROJECT_ID` - Project ID of the test project.
    - `TEST_MANAGE_API_APPLICATION_TOKEN` - Application token with scope `notifications:push-event`.
- Set one of Azure or AWS resources (or both, but only one is needed).

### AWS Setup

[](#aws-setup)

- Create a user (`NotificationUser`) for local development using the `provisioning/aws.json` CF template.
    - Create AWS key for the created user.
    - Set the following environment variables in `set-env.sh` file (use `set-env.template.sh` as sample):
        - `TEST_AWS_ACCESS_KEY` - The created security credentials for the `JobQueueApiPhpClient` user.
        - `TEST_AWS_SECRET_ACCESS_KEY` - The created security credentials for the `JobQueueApiPhpClient` user.
        - `AWS_REGION` - `Region` output of the above stack.

### Azure Setup

[](#azure-setup)

- Create a resource group:

    ```
    az account set --subscription "Keboola DEV PS Team CI"
    az group create --name testing-notification-api-php-client --location "East US"
    ```
- Create a service principal:

    ```
    az ad sp create-for-rbac --name testing-notification-api-php-client
    ```
- Use the response to set values `TEST_AZURE_CLIENT_ID`, `TEST_AZURE_CLIENT_SECRET` and `TEST_AZURE_TENANT_ID` in the `set-env.sh` file:

    ```
    {
      "appId": "268a6f05-xxxxxxxxxxxxxxxxxxxxxxxxxxx", //-> TEST_AZURE_CLIENT_ID
      "displayName": "testing-notification-api-php-client",
      "name": "http://testing-notification-api-php-client",
      "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", //-> TEST_AZURE_CLIENT_SECRET
      "tenant": "9b85ee6f-xxxxxxxxxxxxxxxxxxxxxxxxxxx" //-> TEST_AZURE_TENANT_ID
    }
    ```
- Get ID of the service principal:

    ```
    SERVICE_PRINCIPAL_ID=$(az ad sp list --display-name testing-notification-api-php-client --query "[0].objectId" --output tsv)
    ```
- Deploy the Storage Account for logs, provide tenant ID, service principal ID and group ID from the previous commands:

    ```
    az deployment group create --resource-group testing-notification-api-php-client --template-file provisioning/azure.json --parameters vault_name=test-notification-client tenant_id=$TEST_AZURE_TENANT_ID service_principal_object_id=$SERVICE_PRINCIPAL_ID
    ```
- Get the connection string

    ```
    az storage account show-connection-string -g testing-notification-api-php-client -n mirontfcnacc2 --query "connectionString" --output tsv
    ```

Generate environment configuration
----------------------------------

[](#generate-environment-configuration)

```
export DATABASE_URL_BASE64=$(printf "mysql://root:root@dev-mysql-service:3310/notifications?serverVersion=8.0" | base64 --wrap=0)
export DATABASE_PASSWORD_BASE64=$(printf "root" | base64 --wrap=0)
export TEST_AZURE_CLIENT_SECRET_BASE64=$(printf "%s" "$TEST_AZURE_CLIENT_SECRET"| base64 --wrap=0)
export TEST_AWS_SECRET_ACCESS_KEY_BASE64=$(printf "%s" "$TEST_AWS_SECRET_ACCESS_KEY"| base64 --wrap=0)

./set-env.sh
envsubst  provisioning/environments.yaml
kubectl apply -f provisioning/environments.yaml
kubectl apply -f provisioning/notification.yaml
TEST_NOTIFICATION_API_IP=`kubectl get svc --output jsonpath --template "{.items[?(@.metadata.name==\"dev-notification-service\")].status.loadBalancer.ingress[].ip}" --namespace=dev-notification-client`

printf "TEST_NOTIFICATION_API_URL: http://%s:8181" "$TEST_NOTIFICATION_API_IP"
```

Store the result `TEST_NOTIFICATION_API_URL` in `set-env.sh`.

Run tests
---------

[](#run-tests)

- With the above setup, you can run tests:

    ```
    docker compose build
    source ./set-env.sh && docker compose run tests
    ```
- To run tests with local code use:

    ```
    docker compose run tests-local composer install
    source ./set-env.sh && docker compose run tests-local
    ```

License
-------

[](#license)

MIT licensed, see [LICENSE](./LICENSE) file.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance54

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 63.3% 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 ~81 days

Recently: every ~24 days

Total

19

Last Release

306d ago

Major Versions

0.1.0 → 1.0.02021-07-19

1.0.0 → 2.0.02021-08-30

2.7.0 → 3.0.02023-08-03

3.3.0 → 4.0.02025-07-07

PHP version history (3 changes)0.1.0PHP ^7.4

2.7.0PHP ^7.4|^8.0

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/101dbf2551a0709ddab522f97669f13a2c4cc2d0a1e8d009f3af6ba80accb1a9?d=identicon)[Keboola](/maintainers/Keboola)

---

Top Contributors

[![odinuv](https://avatars.githubusercontent.com/u/4319320?v=4)](https://github.com/odinuv "odinuv (76 commits)")[![ErikZigo](https://avatars.githubusercontent.com/u/1726727?v=4)](https://github.com/ErikZigo "ErikZigo (22 commits)")[![pepamartinec](https://avatars.githubusercontent.com/u/271753?v=4)](https://github.com/pepamartinec "pepamartinec (11 commits)")[![MiroCillik](https://avatars.githubusercontent.com/u/1488015?v=4)](https://github.com/MiroCillik "MiroCillik (7 commits)")[![sykora-ji](https://avatars.githubusercontent.com/u/29491790?v=4)](https://github.com/sykora-ji "sykora-ji (3 commits)")[![ujovlado](https://avatars.githubusercontent.com/u/419849?v=4)](https://github.com/ujovlado "ujovlado (1 commits)")

---

Tags

clientnotificationkeboola

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/keboola-notification-api-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/keboola-notification-api-php-client/health.svg)](https://phpackages.com/packages/keboola-notification-api-php-client)
```

###  Alternatives

[symfony/notifier

Sends notifications via one or more channels (email, SMS, ...)

80640.3M290](/packages/symfony-notifier)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[jolicode/jolinotif

Send desktop notifications on Windows, Linux, MacOS.

1.4k11.6M41](/packages/jolicode-jolinotif)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[edujugon/push-notification

Laravel Package to send push notifications to Android and IOS devices. (GCM,FCM,APN)

4891.4M1](/packages/edujugon-push-notification)

PHPackages © 2026

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