PHPackages                             novuhq/novu - 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. novuhq/novu

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

novuhq/novu
===========

v3.14.0(2mo ago)29.7k↓15.5%[1 PRs](https://github.com/novuhq/php-novu/pulls)MITPHPPHP &gt;=8.2CI passing

Since Jan 17Pushed 1mo ago3 watchersCompare

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

READMEChangelog (10)Dependencies (10)Versions (39)Used By (0)

 [   ![Novu Logo](https://user-images.githubusercontent.com/2233092/213641043-3bbb3f21-3c53-4e67-afe5-755aeb222159.png)  ](https://novu.co?utm_source=github)

 [ ![Product Hunt](https://camo.githubusercontent.com/cb2d774196bec5bd1e0fa141eb84b4b92a5666ba74f31a042a64f5fa17e4cd89/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50726f6475637425323048756e742d476f6c64656e2532304b697474792532304177617264253230323032332d79656c6c6f77) ](https://www.producthunt.com/products/novu) [![Hacker News](https://camo.githubusercontent.com/56e8f11cd5b91f8b7483ee88b3497f08c0671b2ccd31d52fa8fa0f59ecece67d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4861636b65722532304e6577732d253233312d253233464636363030)](https://news.ycombinator.com/item?id=38419513) [ ![npm downloads](https://camo.githubusercontent.com/fb711bc8e35499b6d116b78ce4ec5dbd8a91ff6619621305e88e34d2b4925da9/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f646d2f406e6f76752f6e6f6465) ](https://www.npmjs.com/package/@novu/node)

The &lt;Inbox /&gt; infrastructure for modern products
======================================================

[](#the-inbox--infrastructure-for-modern-products)

The notification platform that turns complex multi-channel delivery into a single component. Built for developers, designed for growth, powered by open source.

Novu PHP SDK
============

[](#novu-php-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/cf076b2b7f2e951a13af5cb48601c5b39cf1c780a44c26daa6ca828ddf7edd83/68747470733a2f2f706f7365722e707567782e6f72672f756e69636f646576656c6f7065722f6e6f76752f762f737461626c652e737667)](https://packagist.org/packages/unicodeveloper/novu)[![License](https://camo.githubusercontent.com/cb39d148eefc0deca73c290bda26a400bdc86740e0b05774f63b5be354d64b99/68747470733a2f2f706f7365722e707567782e6f72672f756e69636f646576656c6f7065722f6e6f76752f6c6963656e73652e737667)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/e74b20f581f9da37ebadf0e1dec10c5206b5211c80fc65f9d88cd6c2222dbddd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e69636f646576656c6f7065722f6e6f76752e737667)](https://packagist.org/packages/unicodeveloper/novu)

> The [PHP Novu](https://novu.co) SDK and package provides a fluent and expressive interface for interacting with Novu's API and managing notifications.

Developer-friendly &amp; type-safe Php SDK specifically catered to leverage *novuhq/novu* API.

 [![](https://camo.githubusercontent.com/096b86187dea2c62026c9750456a53a3e7c20fdd95fa1b55f5cc9a67ebc2078d/68747470733a2f2f637573746f6d2d69636f6e2d6261646765732e64656d6f6c61622e636f6d2f62616467652f2d4275696c742532304279253230537065616b656173792d3231323031353f7374796c653d666f722d7468652d6261646765266c6f676f436f6c6f723d464245333331266c6f676f3d737065616b65617379266c6162656c436f6c6f723d353435343534)](https://www.speakeasy.com/?utm_source=novuhq/novu&utm_campaign=php) [ ![](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667) ](https://opensource.org/licenses/MIT)

Important

This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/novu/novu). Delete this section before &gt; publishing to a package manager.

Summary
-------

[](#summary)

Novu API: Novu REST API. Please see  for more details.

For more information about the API: [Novu Documentation](https://docs.novu.co)

Table of Contents
-----------------

[](#table-of-contents)

- [Novu PHP SDK](#novu-php-sdk)
    - [SDK Installation](#sdk-installation)
    - [SDK Example Usage](#sdk-example-usage)
    - [Authentication](#authentication)
    - [Available Resources and Operations](#available-resources-and-operations)
    - [Retries](#retries)
    - [Error Handling](#error-handling)
    - [Server Selection](#server-selection)
- [Development](#development)
    - [Maturity](#maturity)
    - [Contributions](#contributions)

SDK Installation
----------------

[](#sdk-installation)

The SDK relies on [Composer](https://getcomposer.org/) to manage its dependencies.

To install the SDK and add it as a dependency to an existing `composer.json` file:

```
composer require "novuhq/novu"
```

SDK Example Usage
-----------------

[](#sdk-example-usage)

### Trigger Notification Event

[](#trigger-notification-event)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventRequestDto = new Components\TriggerEventRequestDto(
    workflowId: 'workflow_identifier',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\Overrides(),
    to: 'SUBSCRIBER_ID',
    actor: '',
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->trigger(
    triggerEventRequestDto: $triggerEventRequestDto
);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

### Cancel Triggered Event

[](#cancel-triggered-event)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$response = $sdk->cancel(
    transactionId: ''
);

if ($response->boolean !== null) {
    // handle response
}
```

### Broadcast Event to All

[](#broadcast-event-to-all)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventToAllRequestDto = new Components\TriggerEventToAllRequestDto(
    name: '',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\TriggerEventToAllRequestDtoOverrides(
        additionalProperties: [
            'fcm' => [
                'data' => [
                    'key' => 'value',
                ],
            ],
        ],
    ),
    actor: new Components\SubscriberPayloadDto(
        firstName: 'John',
        lastName: 'Doe',
        email: 'john.doe@example.com',
        phone: '+1234567890',
        avatar: 'https://example.com/avatar.jpg',
        locale: 'en-US',
        timezone: 'America/New_York',
        subscriberId: '',
    ),
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->triggerBroadcast(
    triggerEventToAllRequestDto: $triggerEventToAllRequestDto
);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

### Trigger Notification Events in Bulk

[](#trigger-notification-events-in-bulk)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$bulkTriggerEventDto = new Components\BulkTriggerEventDto(
    events: [
        new Components\TriggerEventRequestDto(
            workflowId: 'workflow_identifier',
            payload: [
                'comment_id' => 'string',
                'post' => [
                    'text' => 'string',
                ],
            ],
            overrides: new Components\Overrides(),
            to: 'SUBSCRIBER_ID',
        ),
        new Components\TriggerEventRequestDto(
            workflowId: 'workflow_identifier',
            payload: [
                'comment_id' => 'string',
                'post' => [
                    'text' => 'string',
                ],
            ],
            overrides: new Components\Overrides(),
            to: 'SUBSCRIBER_ID',
        ),
        new Components\TriggerEventRequestDto(
            workflowId: 'workflow_identifier',
            payload: [
                'comment_id' => 'string',
                'post' => [
                    'text' => 'string',
                ],
            ],
            overrides: new Components\Overrides(),
            to: 'SUBSCRIBER_ID',
        ),
    ],
);

$response = $sdk->triggerBulk(
    bulkTriggerEventDto: $bulkTriggerEventDto
);

if ($response->triggerEventResponseDtos !== null) {
    // handle response
}
```

Authentication
--------------

[](#authentication)

### Per-Client Security Schemes

[](#per-client-security-schemes)

This SDK supports the following security scheme globally:

NameTypeScheme`secretKey`apiKeyAPI keyTo authenticate with the API the `secretKey` parameter must be set when initializing the SDK. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventRequestDto = new Components\TriggerEventRequestDto(
    workflowId: 'workflow_identifier',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\Overrides(),
    to: 'SUBSCRIBER_ID',
    actor: '',
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->trigger(
    triggerEventRequestDto: $triggerEventRequestDto
);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

Available Resources and Operations
----------------------------------

[](#available-resources-and-operations)

Available methods### [Novu SDK](docs/sdks/novu/README.md)

[](#novu-sdk)

- [trigger](docs/sdks/novu/README.md#trigger) - Trigger event
- [cancel](docs/sdks/novu/README.md#cancel) - Cancel triggered event
- [triggerBroadcast](docs/sdks/novu/README.md#triggerbroadcast) - Broadcast event to all
- [triggerBulk](docs/sdks/novu/README.md#triggerbulk) - Bulk trigger event

### [Activity](docs/sdks/activity/README.md)

[](#activity)

- [track](docs/sdks/activity/README.md#track) - Track activity and engagement events

### [ChannelConnections](docs/sdks/channelconnections/README.md)

[](#channelconnections)

- [list](docs/sdks/channelconnections/README.md#list) - List all channel connections
- [create](docs/sdks/channelconnections/README.md#create) - Create a channel connection
- [retrieve](docs/sdks/channelconnections/README.md#retrieve) - Retrieve a channel connection
- [update](docs/sdks/channelconnections/README.md#update) - Update a channel connection
- [delete](docs/sdks/channelconnections/README.md#delete) - Delete a channel connection

### [ChannelEndpoints](docs/sdks/channelendpoints/README.md)

[](#channelendpoints)

- [list](docs/sdks/channelendpoints/README.md#list) - List all channel endpoints
- [create](docs/sdks/channelendpoints/README.md#create) - Create a channel endpoint
- [retrieve](docs/sdks/channelendpoints/README.md#retrieve) - Retrieve a channel endpoint
- [update](docs/sdks/channelendpoints/README.md#update) - Update a channel endpoint
- [delete](docs/sdks/channelendpoints/README.md#delete) - Delete a channel endpoint

### [Contexts](docs/sdks/contexts/README.md)

[](#contexts)

- [create](docs/sdks/contexts/README.md#create) - Create a context
- [list](docs/sdks/contexts/README.md#list) - List all contexts
- [update](docs/sdks/contexts/README.md#update) - Update a context
- [retrieve](docs/sdks/contexts/README.md#retrieve) - Retrieve a context
- [delete](docs/sdks/contexts/README.md#delete) - Delete a context

### [Environments](docs/sdks/environments/README.md)

[](#environments)

- [getTags](docs/sdks/environments/README.md#gettags) - List environment tags
- [create](docs/sdks/environments/README.md#create) - Create an environment
- [list](docs/sdks/environments/README.md#list) - List all environments
- [update](docs/sdks/environments/README.md#update) - Update an environment
- [delete](docs/sdks/environments/README.md#delete) - Delete an environment

### [Integrations](docs/sdks/integrations/README.md)

[](#integrations)

- [list](docs/sdks/integrations/README.md#list) - List all integrations
- [create](docs/sdks/integrations/README.md#create) - Create an integration
- [update](docs/sdks/integrations/README.md#update) - Update an integration
- [delete](docs/sdks/integrations/README.md#delete) - Delete an integration
- [integrationsControllerAutoConfigureIntegration](docs/sdks/integrations/README.md#integrationscontrollerautoconfigureintegration) - Auto-configure an integration for inbound webhooks
- [setAsPrimary](docs/sdks/integrations/README.md#setasprimary) - Update integration as primary
- [listActive](docs/sdks/integrations/README.md#listactive) - List active integrations
- [generateChatOAuthUrl](docs/sdks/integrations/README.md#generatechatoauthurl) - Generate chat OAuth URL

### [Layouts](docs/sdks/layouts/README.md)

[](#layouts)

- [create](docs/sdks/layouts/README.md#create) - Create a layout
- [list](docs/sdks/layouts/README.md#list) - List all layouts
- [update](docs/sdks/layouts/README.md#update) - Update a layout
- [retrieve](docs/sdks/layouts/README.md#retrieve) - Retrieve a layout
- [delete](docs/sdks/layouts/README.md#delete) - Delete a layout
- [duplicate](docs/sdks/layouts/README.md#duplicate) - Duplicate a layout
- [generatePreview](docs/sdks/layouts/README.md#generatepreview) - Generate layout preview
- [usage](docs/sdks/layouts/README.md#usage) - Get layout usage

### [Messages](docs/sdks/messages/README.md)

[](#messages)

- [get](docs/sdks/messages/README.md#get) - List all messages
- [delete](docs/sdks/messages/README.md#delete) - Delete a message
- [deleteByTransactionId](docs/sdks/messages/README.md#deletebytransactionid) - Delete messages by transactionId

### [Notifications](docs/sdks/notifications/README.md)

[](#notifications)

- [list](docs/sdks/notifications/README.md#list) - List all events
- [get](docs/sdks/notifications/README.md#get) - Retrieve an event

### [Subscribers](docs/sdks/subscribers/README.md)

[](#subscribers)

- [search](docs/sdks/subscribers/README.md#search) - Search subscribers
- [create](docs/sdks/subscribers/README.md#create) - Create a subscriber
- [get](docs/sdks/subscribers/README.md#get) - Retrieve a subscriber
- [patch](docs/sdks/subscribers/README.md#patch) - Update a subscriber
- [delete](docs/sdks/subscribers/README.md#delete) - Delete a subscriber
- [createBulk](docs/sdks/subscribers/README.md#createbulk) - Bulk create subscribers
- [updatePreferences](docs/sdks/subscribers/README.md#updatepreferences) - Update subscriber preferences
- [updateCredentials](docs/sdks/subscribers/README.md#updatecredentials) - Update provider credentials
- [updateOnlineStatus](docs/sdks/subscribers/README.md#updateonlinestatus) - Update subscriber online status

#### [Subscribers.Preferences](docs/sdks/preferences/README.md)

[](#subscriberspreferences)

- [bulkUpdate](docs/sdks/preferences/README.md#bulkupdate) - Bulk update subscriber preferences

#### [Subscribers.Topics](docs/sdks/novutopics/README.md)

[](#subscriberstopics)

- [list](docs/sdks/novutopics/README.md#list) - Retrieve subscriber subscriptions

### [Subscribers.Messages](docs/sdks/novumessages/README.md)

[](#subscribersmessages)

- [updateAsSeen](docs/sdks/novumessages/README.md#updateasseen) - Update notification action status
- [markAllAs](docs/sdks/novumessages/README.md#markallas) - Update notifications state

### [Subscribers.Notifications](docs/sdks/novunotifications/README.md)

[](#subscribersnotifications)

- [getFeed](docs/sdks/novunotifications/README.md#getfeed) - Retrieve subscriber notifications

### [SubscribersCredentials](docs/sdks/subscriberscredentials/README.md)

[](#subscriberscredentials)

- [append](docs/sdks/subscriberscredentials/README.md#append) - Upsert provider credentials
- [deleteProvider](docs/sdks/subscriberscredentials/README.md#deleteprovider) - Delete provider credentials

### [SubscribersMessages](docs/sdks/subscribersmessages/README.md)

[](#subscribersmessages-1)

- [markAll](docs/sdks/subscribersmessages/README.md#markall) - Update all notifications state

### [SubscribersNotifications](docs/sdks/subscribersnotifications/README.md)

[](#subscribersnotifications-1)

- [getUnseenCount](docs/sdks/subscribersnotifications/README.md#getunseencount) - Retrieve unseen notifications count

### [SubscribersPreferences](docs/sdks/subscriberspreferences/README.md)

[](#subscriberspreferences-1)

- [list](docs/sdks/subscriberspreferences/README.md#list) - Retrieve subscriber preferences

### [Topics](docs/sdks/topics/README.md)

[](#topics)

- [list](docs/sdks/topics/README.md#list) - List all topics
- [create](docs/sdks/topics/README.md#create) - Create a topic
- [get](docs/sdks/topics/README.md#get) - Retrieve a topic
- [update](docs/sdks/topics/README.md#update) - Update a topic
- [delete](docs/sdks/topics/README.md#delete) - Delete a topic

#### [Topics.Subscriptions](docs/sdks/subscriptions/README.md)

[](#topicssubscriptions)

- [list](docs/sdks/subscriptions/README.md#list) - List topic subscriptions
- [create](docs/sdks/subscriptions/README.md#create) - Create topic subscriptions
- [delete](docs/sdks/subscriptions/README.md#delete) - Delete topic subscriptions
- [getSubscription](docs/sdks/subscriptions/README.md#getsubscription) - Retrieve a topic subscription
- [update](docs/sdks/subscriptions/README.md#update) - Update a topic subscription

### [TopicsSubscribers](docs/sdks/topicssubscribers/README.md)

[](#topicssubscribers)

- [check](docs/sdks/topicssubscribers/README.md#check) - Check topic subscriber

### [Translations](docs/sdks/translations/README.md)

[](#translations)

- [create](docs/sdks/translations/README.md#create) - Create a translation
- [retrieve](docs/sdks/translations/README.md#retrieve) - Retrieve a translation
- [delete](docs/sdks/translations/README.md#delete) - Delete a translation
- [upload](docs/sdks/translations/README.md#upload) - Upload translation files

#### [Translations.Groups](docs/sdks/groups/README.md)

[](#translationsgroups)

- [delete](docs/sdks/groups/README.md#delete) - Delete a translation group
- [retrieve](docs/sdks/groups/README.md#retrieve) - Retrieve a translation group

#### [Translations.Master](docs/sdks/master/README.md)

[](#translationsmaster)

- [retrieve](docs/sdks/master/README.md#retrieve) - Retrieve master translations JSON
- [import](docs/sdks/master/README.md#import) - Import master translations JSON
- [upload](docs/sdks/master/README.md#upload) - Upload master translations JSON file

### [Workflows](docs/sdks/workflows/README.md)

[](#workflows)

- [create](docs/sdks/workflows/README.md#create) - Create a workflow
- [list](docs/sdks/workflows/README.md#list) - List all workflows
- [update](docs/sdks/workflows/README.md#update) - Update a workflow
- [get](docs/sdks/workflows/README.md#get) - Retrieve a workflow
- [delete](docs/sdks/workflows/README.md#delete) - Delete a workflow
- [patch](docs/sdks/workflows/README.md#patch) - Update a workflow
- [sync](docs/sdks/workflows/README.md#sync) - Sync a workflow

#### [Workflows.Steps](docs/sdks/steps/README.md)

[](#workflowssteps)

- [retrieve](docs/sdks/steps/README.md#retrieve) - Retrieve workflow step

Retries
-------

[](#retries)

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide an `Options` object built with a `RetryConfig` object to the call:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;
use novu\Utils\Retry;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventRequestDto = new Components\TriggerEventRequestDto(
    workflowId: 'workflow_identifier',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\Overrides(),
    to: 'SUBSCRIBER_ID',
    actor: '',
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->trigger(
    triggerEventRequestDto: $triggerEventRequestDto,
    options: Utils\Options->builder()->setRetryConfig(
        new Retry\RetryConfigBackoff(
            initialInterval: 1,
            maxInterval:     50,
            exponent:        1.1,
            maxElapsedTime:  100,
            retryConnectionErrors: false,
        ))->build()

);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

If you'd like to override the default retry strategy for all operations that support retries, you can pass a `RetryConfig` object to the `SDKBuilder->setRetryConfig` function when initializing the SDK:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;
use novu\Utils\Retry;

$sdk = novu\Novu::builder()
    ->setRetryConfig(
        new Retry\RetryConfigBackoff(
            initialInterval: 1,
            maxInterval:     50,
            exponent:        1.1,
            maxElapsedTime:  100,
            retryConnectionErrors: false,
        )
  )
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventRequestDto = new Components\TriggerEventRequestDto(
    workflowId: 'workflow_identifier',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\Overrides(),
    to: 'SUBSCRIBER_ID',
    actor: '',
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->trigger(
    triggerEventRequestDto: $triggerEventRequestDto
);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

Error Handling
--------------

[](#error-handling)

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default an API error will raise a `Errors\APIException` exception, which has the following properties:

PropertyTypeDescription`$message`*string*The error message`$statusCode`*int*The HTTP status code`$rawResponse`*?\\Psr\\Http\\Message\\ResponseInterface*The raw HTTP response`$body`*string*The response contentWhen custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `trigger` method throws the following exceptions:

Error TypeStatus CodeContent TypeErrors\\PayloadValidationExceptionDto400application/jsonErrors\\ErrorDto414application/jsonErrors\\ErrorDto401, 403, 404, 405, 409, 413, 415application/jsonErrors\\ValidationErrorDto422application/jsonErrors\\ErrorDto500application/jsonErrors\\APIException4XX, 5XX\*/\*### Example

[](#example)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;
use novu\Models\Errors;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

try {
    $triggerEventRequestDto = new Components\TriggerEventRequestDto(
        workflowId: 'workflow_identifier',
        payload: [
            'comment_id' => 'string',
            'post' => [
                'text' => 'string',
            ],
        ],
        overrides: new Components\Overrides(),
        to: 'SUBSCRIBER_ID',
        actor: '',
        context: [
            'key' => 'org-acme',
        ],
    );

    $response = $sdk->trigger(
        triggerEventRequestDto: $triggerEventRequestDto
    );

    if ($response->triggerEventResponseDto !== null) {
        // handle response
    }
} catch (Errors\PayloadValidationExceptionDtoThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\ErrorDtoThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\ErrorDtoThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\ValidationErrorDtoThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\ErrorDtoThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\APIException $e) {
    // handle default exception
    throw $e;
}
```

Server Selection
----------------

[](#server-selection)

### Select Server by Index

[](#select-server-by-index)

You can override the default server globally using the `setServerIndex(int $serverIdx)` builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

\#ServerDescription0`https://api.novu.co`1`https://eu.api.novu.co`#### Example

[](#example-1)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setServerIndex(0)
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventRequestDto = new Components\TriggerEventRequestDto(
    workflowId: 'workflow_identifier',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\Overrides(),
    to: 'SUBSCRIBER_ID',
    actor: '',
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->trigger(
    triggerEventRequestDto: $triggerEventRequestDto
);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

### Override Server URL Per-Client

[](#override-server-url-per-client)

The default server can also be overridden globally using the `setServerUrl(string $serverUrl)` builder method when initializing the SDK client instance. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setServerURL('https://eu.api.novu.co')
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$triggerEventRequestDto = new Components\TriggerEventRequestDto(
    workflowId: 'workflow_identifier',
    payload: [
        'comment_id' => 'string',
        'post' => [
            'text' => 'string',
        ],
    ],
    overrides: new Components\Overrides(),
    to: 'SUBSCRIBER_ID',
    actor: '',
    context: [
        'key' => 'org-acme',
    ],
);

$response = $sdk->trigger(
    triggerEventRequestDto: $triggerEventRequestDto
);

if ($response->triggerEventResponseDto !== null) {
    // handle response
}
```

Development
===========

[](#development)

Maturity
--------

[](#maturity)

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions
-------------

[](#contributions)

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=novuhq/novu&utm_campaign=php)

[](#sdk-created-by-speakeasy)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~23 days

Recently: every ~15 days

Total

18

Last Release

84d ago

Major Versions

v0.2.0 → v1.0.02025-05-13

v1.3.0 → v3.11.02025-11-19

PHP version history (2 changes)v0.0.1PHP ^8.2

v3.11.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/755de11314a5dd407dc71527584b0efbdcf15a75d58bb05a171f96a7da27a5c0?d=identicon)[novuhq](/maintainers/novuhq)

---

Top Contributors

[![tatarco](https://avatars.githubusercontent.com/u/39020298?v=4)](https://github.com/tatarco "tatarco (15 commits)")[![merrcury](https://avatars.githubusercontent.com/u/35988194?v=4)](https://github.com/merrcury "merrcury (12 commits)")[![speakeasybot](https://avatars.githubusercontent.com/u/108416695?v=4)](https://github.com/speakeasybot "speakeasybot (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")[![SokratisVidros](https://avatars.githubusercontent.com/u/1352422?v=4)](https://github.com/SokratisVidros "SokratisVidros (3 commits)")[![jainpawan21](https://avatars.githubusercontent.com/u/39362422?v=4)](https://github.com/jainpawan21 "jainpawan21 (2 commits)")[![speakeasy-github[bot]](https://avatars.githubusercontent.com/in/308252?v=4)](https://github.com/speakeasy-github[bot] "speakeasy-github[bot] (1 commits)")

---

Tags

notification-servicenovuphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/novuhq-novu/health.svg)

```
[![Health](https://phpackages.com/badges/novuhq-novu/health.svg)](https://phpackages.com/packages/novuhq-novu)
```

###  Alternatives

[clerkinc/backend-php

2755.0k](/packages/clerkinc-backend-php)[polar-sh/sdk

4014.5k4](/packages/polar-sh-sdk)[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)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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