PHPackages                             onesignal/onesignal-php-api - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. onesignal/onesignal-php-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

onesignal/onesignal-php-api
===========================

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

5.3.0(1mo ago)34170.2k—7.1%13[1 issues](https://github.com/OneSignal/onesignal-php-api/issues)2PHPPHP ^7.3 || ^8.0CI passing

Since Jan 22Pushed 1mo ago29 watchersCompare

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

READMEChangelog (8)Dependencies (6)Versions (14)Used By (2)

OneSignal
=========

[](#onesignal)

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

For more information, please visit .

Installation &amp; Usage
------------------------

[](#installation--usage)

### Requirements

[](#requirements)

PHP 7.3 and later.

### Composer

[](#composer)

To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/OneSignal/onesignal-php-api.git"
    }
  ],
  "require": {
    "onesignal/onesignal-php-api": "*@dev"
  }
}
```

Then run `composer update`

Usage examples
--------------

[](#usage-examples)

### Imports

[](#imports)

```
use DateTime;
use onesignal\client\api\DefaultApi;
use onesignal\client\Configuration;
use onesignal\client\model\GetNotificationRequestBody;
use onesignal\client\model\Notification;
use onesignal\client\model\StringMap;
use onesignal\client\model\Player;
use onesignal\client\model\UpdatePlayerTagsRequestBody;
use onesignal\client\model\ExportPlayersRequestBody;
use onesignal\client\model\Segment;
use onesignal\client\model\FilterExpressions;
use PHPUnit\Framework\TestCase;
use GuzzleHttp;
```

### Constants

[](#constants)

```
const APP_ID = '';
const REST_API_KEY_TOKEN = ''; // App REST API key required for most endpoints
const ORGANIZATION_API_KEY_TOKEN = ''; // Organization key is only required for creating new apps and other top-level endpoints
```

### Configure authorization

[](#configure-authorization)

```
$config = Configuration::getDefaultConfiguration()
    ->setRestApiKeyToken(REST_API_KEY_TOKEN)
    ->setOrganizationApiKeyToken(ORGANIZATION_API_KEY_TOKEN);

$apiInstance = new DefaultApi(
    new GuzzleHttp\Client(),
    $config
);
```

Notifications
-------------

[](#notifications)

### Creating a notification model

[](#creating-a-notification-model)

```
function createNotification($enContent): Notification {
    $content = new StringMap();
    $content->setEn($enContent);

    $notification = new Notification();
    $notification->setAppId(APP_ID);
    $notification->setContents($content);
    $notification->setIncludedSegments(['Subscribed Users']);

    return $notification;
}
```

### Sending a notification immediately

[](#sending-a-notification-immediately)

```
$notification = createNotification('PHP Test notification');

$result = $apiInstance->createNotification($notification);
print_r($result);
```

### Scheduling a notification to be sent in 24 hours

[](#scheduling-a-notification-to-be-sent-in-24-hours)

```
$notification = self::createNotification('PHP Test scheduled notification');
$dt = new DateTime();
$dt->modify('+1 day');
$notification->setSendAfter($dt);

$scheduledNotification = $apiInstance->createNotification($notification);
print_r($scheduledNotification);
```

### Sending a notification using Filters

[](#sending-a-notification-using-filters)

Send this notification only to the users that have not spent any USD on IAP.

```
$notification = createNotification('PHP Test filtered notification');
$filter1 = new Filter();
$filter1->setField('amount_spent');
$filter1->setRelation('=');
$filter1->setValue('0');
$notification->setFilters([$filter1]);
$result = $apiInstance->createNotification($notification);
print_r($result);
```

### Sending a notification immediately

[](#sending-a-notification-immediately-1)

```
$notification = createNotification('PHP Test notification');

$result = $apiInstance->createNotification($notification);
print_r($result);
```

### Retrieving a notification

[](#retrieving-a-notification)

```
$scheduledNotification = $apiInstance->getNotification(APP_ID, $scheduledNotification->getId());
print_r($scheduledNotification);
```

### Listing notifications by application ID

[](#listing-notifications-by-application-id)

```
$getResult = $apiInstance->getNotifications(APP_ID);
print_r($getResult->getNotifications());
```

### Getting notification history

[](#getting-notification-history)

```
$requestBody = new GetNotificationRequestBody();
$requestBody
    ->setAppId(APP_ID)
    ->setEvents('sent');

$getResult = $apiInstance->getNotificationHistory($scheduledNotification->getId(), $requestBody);
print_r($getResult->getSuccess());
```

Players
-------

[](#players)

### Creating a new Player model

[](#creating-a-new-player-model)

```
function createPlayerModel($playerId): Player {
    $player = new Player();

    $player->setAppId(APP_ID);
    $player->setIdentifier($playerId);
    $player->setDeviceType(1);

    return $player;
}
```

### Creating a Player

[](#creating-a-player)

```
$player = createPlayerModel('php_test_player_id');
$createPlayerResult = $apiInstance->createPlayer($player);
print_r($createPlayerResult);
```

### Getting a Player

[](#getting-a-player)

```
$getPlayerResult = $apiInstance->getPlayer(APP_ID, 'php_test_player_id');
print_r($getPlayerResult);
```

### Getting a list of Players

[](#getting-a-list-of-players)

```
$limit = 10;
$getPlayersResult = $apiInstance->getPlayers(APP_ID, $limit);
print_r($getPlayersResult->getPlayers());
```

### Deleting a player

[](#deleting-a-player)

```
$deletePlayerResult = $apiInstance->deletePlayer(APP_ID, 'php_test_player_id');
print_r($deletePlayerResult->getSuccess());
```

### Exporting players into CSV-spreadsheet

[](#exporting-players-into-csv-spreadsheet)

```
$exportPlayersRequestBody = new ExportPlayersRequestBody();
$exportPlayersRequestBody->setExtraFields([]);
$exportPlayersRequestBody->setSegmentName('');

$exportPlayersResult =  $apiInstance->exportPlayers(APP_ID, $exportPlayersRequestBody);
print_r($exportPlayersResult->getCsvFileUrl());
```

Segments
--------

[](#segments)

### Creating a segment

[](#creating-a-segment)

```
// Settings up the filter. Filters determine a segment.
$filterExpressions = new FilterExpressions();
$filterExpressions->setField('session_count');
$filterExpressions->setRelation('>');
$filterExpressions->setValue('1');
```

### Setting up the segment itself

[](#setting-up-the-segment-itself)

```
$segment = new Segment();
$segment->setName('test_segment_name');
$segment->setFilters([$filterExpressions]);

$createSegmentResponse = $apiInstance->createSegments(APP_ID, $segment);
print_r($createSegmentResponse);
```

### Deleting a segment

[](#deleting-a-segment)

```
$deleteSegmentResponse = $apiInstance->deleteSegments(APP_ID, $createSegmentResponse->getId());
print_r($deleteSegmentResponse->getSuccess());
```

Working with Apps
-----------------

[](#working-with-apps)

### Getting an app

[](#getting-an-app)

```
$getAppResponse = $apiInstance->getApp(APP_ID);
print_r($getAppResponse);
```

### Getting a list of apps

[](#getting-a-list-of-apps)

```
$getAppsResponse = $apiInstance->getApps();
print_r($getAppsResponse);
```

### Updating an app

[](#updating-an-app)

```
$getAppResponse = $apiInstance->getApp(APP_ID);
$getAppResponse->setName('php_test_app_name');
$updateAppResponse = $apiInstance->updateApp(APP_ID, $getAppResponse);
print_r($updateAppResponse);
```

### Outcomes

[](#outcomes)

```
$outcomeNames = "os__session_duration.count,os__click.count";
$outcomeTimeRange = "1d";
$outcomePlatforms = "5";
$outcomeAttribution = "direct";
$outcomesResponse = $apiInstance->getOutcomes(APP_ID, $outcomeNames, null, $outcomeTimeRange, $outcomePlatforms, $outcomeAttribution);
print_r($outcomesResponse->getOutcomes());
```

Live Activities
---------------

[](#live-activities)

### Begin Live Activity

[](#begin-live-activity)

```
$activityId = "activity_id_example";
$beginLiveActivityRequest = new BeginLiveActivityRequest(array(
    'push_token' => "push_token_example",
    'subscription_id' => "player_id_example"
));

self::$apiInstance->beginLiveActivity(APP_ID, $activityId, $beginLiveActivityRequest);
```

### Update Live Activity

[](#update-live-activity)

```
$activityId = "activity_id_example";
$updateLiveActivityRequest = new UpdateLiveActivityRequest(array(
    'event' => 'update',
    'name' => 'contents',
    'event_updates' => array('data' => 'test')
));

self::$apiInstance->updateLiveActivity(APP_ID, $activityId, $updateLiveActivityRequest);
```

### End Live Activity

[](#end-live-activity)

```
$activityId = "activity_id_example";
$subscriptionId = "player_id_example";
self::$apiInstance->endLiveActivity(APP_ID, $activityId, $subscriptionId);
```

Users
-----

[](#users)

### Creating a user

[](#creating-a-user)

```
// Create user model
$user = new User();
$aliasLabel = '';
$aliasId = '';
$pushToken = '';

$subscriptionObject = new SubscriptionObject();
$subscriptionObject->setType('iOSPush');
$subscriptionObject->setToken($pushToken);

$user->setIdentity(array($aliasLabel => $aliasId));
$user->setSubscriptions([$subscriptionObject]);

// Send model to API
$createUserResponse = self::$apiInstance->createUser(APP_ID, $user);
```

### Fetch user by an alias

[](#fetch-user-by-an-alias)

```
$fetchUserResponse = self::$apiInstance->fetchUser(APP_ID, $aliasLabel, $aliasId);
```

### Update user

[](#update-user)

```
$updateUserRequest = new UpdateUserRequest(array(
    'properties' => array(
        'language' => 'fr'
    ))
);

$updateUserResponse = self::$apiInstance->updateUser(APP_ID, $aliasLabel, $aliasId, $updateUserRequest);
```

### Delete user

[](#delete-user)

```
self::$apiInstance->deleteUser(APP_ID, $aliasLabel, $aliasId);
```

### Create subscription

[](#create-subscription)

```
$createSubscriptionRequestBody = new CreateSubscriptionRequestBody();
$subscriptionObject = new SubscriptionObject();
$subscriptionObject->setType('AndroidPush');
$subscriptionObject->setToken('DEVICE_PUSH_TOKEN');
$createSubscriptionRequestBody->setSubscription($subscriptionObject);

$createSubscriptionResponse =
    self::$apiInstance->createSubscription(APP_ID, $aliasLabel, $aliasId, $createSubscriptionRequestBody);
```

### Update subscription

[](#update-subscription)

```
$updateSubscriptionRequestBody = new UpdateSubscriptionRequestBody();
$subscriptionObject = new SubscriptionObject();
$subscriptionObject->setType('AndroidPush');
$subscriptionObject->setToken('DEVICE_PUSH_TOKEN'
$updateSubscriptionRequestBody->setSubscription($subscriptionObject);

self::$apiInstance->updateSubscription(APP_ID, $subscriptionId, $updateSubscriptionRequestBody);
```

### Delete subscription

[](#delete-subscription)

```
self::$apiInstance->deleteSubscription(APP_ID, '');
```

### Delete Alias

[](#delete-alias)

```
self::$apiInstance->deleteAlias(APP_ID, '', '', '');
```

### Fetch aliases by subscription id

[](#fetch-aliases-by-subscription-id)

```
$fetchAliasesResponse = self::$apiInstance->fetchAliases(APP_ID, '');
```

### Fetch aliases by another alias

[](#fetch-aliases-by-another-alias)

```
$fetchAliasesResponse = self::$apiInstance->fetchUserIdentity(APP_ID, '', '');
```

### Identify user by subscription id

[](#identify-user-by-subscription-id)

```
$userIdentityRequestBody = new UserIdentityRequestBody();

$userIdentityRequestBody->setIdentity(array(
    '' => ''
));

// Act
$fetchAliasesResponse = self::$apiInstance->identifyUserBySubscriptionId(
    APP_ID, '', $userIdentityRequestBody);
```

### Identify user by another alias

[](#identify-user-by-another-alias)

```
$userIdentityRequestBody = new UserIdentityRequestBody();

$userIdentityRequestBody->setIdentity(array(
    '' => ''
));

// Act
$fetchAliasesResponse = self::$apiInstance->identifyUserByAlias(
    APP_ID, '', '', $userIdentityRequestBody);
```

### Transfer subscription to another user

[](#transfer-subscription-to-another-user)

```
$transferSubscriptionRequestBody = new TransferSubscriptionRequestBody();
$transferSubscriptionRequestBody->setIdentity(array('' => ''));

// Act
$transferSubscriptionResponse = self::$apiInstance->transferSubscription(
    APP_ID, '', $transferSubscriptionRequestBody);
```

### Fetch in app messages

[](#fetch-in-app-messages)

```
$getEligibleIamsResponse = self::$apiInstance->getEligibleIams(APP_ID, '');
```

API Endpoints
-------------

[](#api-endpoints)

All URIs are relative to **

ClassMethodHTTP requestDescription*DefaultApi*[**cancelNotification**](docs/Api/DefaultApi.md#cancelnotification)**DELETE** /notifications/{notification\_id}Stop a scheduled or currently outgoing notification*DefaultApi*[**copyTemplateToApp**](docs/Api/DefaultApi.md#copytemplatetoapp)**POST** /templates/{template\_id}/copy\_to\_appCopy template to another app*DefaultApi*[**createAlias**](docs/Api/DefaultApi.md#createalias)**PATCH** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}/identity*DefaultApi*[**createAliasBySubscription**](docs/Api/DefaultApi.md#createaliasbysubscription)**PATCH** /apps/{app\_id}/subscriptions/{subscription\_id}/user/identity*DefaultApi*[**createApiKey**](docs/Api/DefaultApi.md#createapikey)**POST** /apps/{app\_id}/auth/tokensCreate API key*DefaultApi*[**createApp**](docs/Api/DefaultApi.md#createapp)**POST** /appsCreate an app*DefaultApi*[**createCustomEvents**](docs/Api/DefaultApi.md#createcustomevents)**POST** /apps/{app\_id}/integrations/custom\_eventsCreate custom events*DefaultApi*[**createNotification**](docs/Api/DefaultApi.md#createnotification)**POST** /notificationsCreate notification*DefaultApi*[**createSegment**](docs/Api/DefaultApi.md#createsegment)**POST** /apps/{app\_id}/segmentsCreate Segment*DefaultApi*[**createSubscription**](docs/Api/DefaultApi.md#createsubscription)**POST** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}/subscriptions*DefaultApi*[**createTemplate**](docs/Api/DefaultApi.md#createtemplate)**POST** /templatesCreate template*DefaultApi*[**createUser**](docs/Api/DefaultApi.md#createuser)**POST** /apps/{app\_id}/users*DefaultApi*[**deleteAlias**](docs/Api/DefaultApi.md#deletealias)**DELETE** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}/identity/{alias\_label\_to\_delete}*DefaultApi*[**deleteApiKey**](docs/Api/DefaultApi.md#deleteapikey)**DELETE** /apps/{app\_id}/auth/tokens/{token\_id}Delete API key*DefaultApi*[**deleteSegment**](docs/Api/DefaultApi.md#deletesegment)**DELETE** /apps/{app\_id}/segments/{segment\_id}Delete Segment*DefaultApi*[**deleteSubscription**](docs/Api/DefaultApi.md#deletesubscription)**DELETE** /apps/{app\_id}/subscriptions/{subscription\_id}*DefaultApi*[**deleteTemplate**](docs/Api/DefaultApi.md#deletetemplate)**DELETE** /templates/{template\_id}Delete template*DefaultApi*[**deleteUser**](docs/Api/DefaultApi.md#deleteuser)**DELETE** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}*DefaultApi*[**exportEvents**](docs/Api/DefaultApi.md#exportevents)**POST** /notifications/{notification\_id}/export\_events?app\_id={app\_id}Export CSV of Events*DefaultApi*[**exportSubscriptions**](docs/Api/DefaultApi.md#exportsubscriptions)**POST** /players/csv\_export?app\_id={app\_id}Export CSV of Subscriptions*DefaultApi*[**getAliases**](docs/Api/DefaultApi.md#getaliases)**GET** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}/identity*DefaultApi*[**getAliasesBySubscription**](docs/Api/DefaultApi.md#getaliasesbysubscription)**GET** /apps/{app\_id}/subscriptions/{subscription\_id}/user/identity*DefaultApi*[**getApp**](docs/Api/DefaultApi.md#getapp)**GET** /apps/{app\_id}View an app*DefaultApi*[**getApps**](docs/Api/DefaultApi.md#getapps)**GET** /appsView apps*DefaultApi*[**getNotification**](docs/Api/DefaultApi.md#getnotification)**GET** /notifications/{notification\_id}View notification*DefaultApi*[**getNotificationHistory**](docs/Api/DefaultApi.md#getnotificationhistory)**POST** /notifications/{notification\_id}/historyNotification History*DefaultApi*[**getNotifications**](docs/Api/DefaultApi.md#getnotifications)**GET** /notificationsView notifications*DefaultApi*[**getOutcomes**](docs/Api/DefaultApi.md#getoutcomes)**GET** /apps/{app\_id}/outcomesView Outcomes*DefaultApi*[**getSegments**](docs/Api/DefaultApi.md#getsegments)**GET** /apps/{app\_id}/segmentsGet Segments*DefaultApi*[**getUser**](docs/Api/DefaultApi.md#getuser)**GET** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}*DefaultApi*[**rotateApiKey**](docs/Api/DefaultApi.md#rotateapikey)**POST** /apps/{app\_id}/auth/tokens/{token\_id}/rotateRotate API key*DefaultApi*[**startLiveActivity**](docs/Api/DefaultApi.md#startliveactivity)**POST** /apps/{app\_id}/activities/activity/{activity\_type}Start Live Activity*DefaultApi*[**transferSubscription**](docs/Api/DefaultApi.md#transfersubscription)**PATCH** /apps/{app\_id}/subscriptions/{subscription\_id}/owner*DefaultApi*[**unsubscribeEmailWithToken**](docs/Api/DefaultApi.md#unsubscribeemailwithtoken)**POST** /apps/{app\_id}/notifications/{notification\_id}/unsubscribeUnsubscribe with token*DefaultApi*[**updateApiKey**](docs/Api/DefaultApi.md#updateapikey)**PATCH** /apps/{app\_id}/auth/tokens/{token\_id}Update API key*DefaultApi*[**updateApp**](docs/Api/DefaultApi.md#updateapp)**PUT** /apps/{app\_id}Update an app*DefaultApi*[**updateLiveActivity**](docs/Api/DefaultApi.md#updateliveactivity)**POST** /apps/{app\_id}/live\_activities/{activity\_id}/notificationsUpdate a Live Activity via Push*DefaultApi*[**updateSubscription**](docs/Api/DefaultApi.md#updatesubscription)**PATCH** /apps/{app\_id}/subscriptions/{subscription\_id}*DefaultApi*[**updateSubscriptionByToken**](docs/Api/DefaultApi.md#updatesubscriptionbytoken)**PATCH** /apps/{app\_id}/subscriptions\_by\_token/{token\_type}/{token}Update subscription by token*DefaultApi*[**updateTemplate**](docs/Api/DefaultApi.md#updatetemplate)**PATCH** /templates/{template\_id}Update template*DefaultApi*[**updateUser**](docs/Api/DefaultApi.md#updateuser)**PATCH** /apps/{app\_id}/users/by/{alias\_label}/{alias\_id}*DefaultApi*[**viewApiKeys**](docs/Api/DefaultApi.md#viewapikeys)**GET** /apps/{app\_id}/auth/tokensView API keys*DefaultApi*[**viewTemplate**](docs/Api/DefaultApi.md#viewtemplate)**GET** /templates/{template\_id}View template*DefaultApi*[**viewTemplates**](docs/Api/DefaultApi.md#viewtemplates)**GET** /templatesView templatesModels
------

[](#models)

- [ApiKeyToken](docs/Model/ApiKeyToken.md)
- [ApiKeyTokensListResponse](docs/Model/ApiKeyTokensListResponse.md)
- [App](docs/Model/App.md)
- [BasicNotification](docs/Model/BasicNotification.md)
- [BasicNotificationAllOf](docs/Model/BasicNotificationAllOf.md)
- [BasicNotificationAllOfAndroidBackgroundLayout](docs/Model/BasicNotificationAllOfAndroidBackgroundLayout.md)
- [Button](docs/Model/Button.md)
- [CopyTemplateRequest](docs/Model/CopyTemplateRequest.md)
- [CreateApiKeyRequest](docs/Model/CreateApiKeyRequest.md)
- [CreateApiKeyResponse](docs/Model/CreateApiKeyResponse.md)
- [CreateNotificationSuccessResponse](docs/Model/CreateNotificationSuccessResponse.md)
- [CreateSegmentConflictResponse](docs/Model/CreateSegmentConflictResponse.md)
- [CreateSegmentSuccessResponse](docs/Model/CreateSegmentSuccessResponse.md)
- [CreateTemplateRequest](docs/Model/CreateTemplateRequest.md)
- [CreateUserConflictResponse](docs/Model/CreateUserConflictResponse.md)
- [CreateUserConflictResponseErrorsInner](docs/Model/CreateUserConflictResponseErrorsInner.md)
- [CreateUserConflictResponseErrorsItemsMeta](docs/Model/CreateUserConflictResponseErrorsItemsMeta.md)
- [CustomEvent](docs/Model/CustomEvent.md)
- [CustomEventsRequest](docs/Model/CustomEventsRequest.md)
- [DeliveryData](docs/Model/DeliveryData.md)
- [ExportEventsSuccessResponse](docs/Model/ExportEventsSuccessResponse.md)
- [ExportSubscriptionsRequestBody](docs/Model/ExportSubscriptionsRequestBody.md)
- [ExportSubscriptionsSuccessResponse](docs/Model/ExportSubscriptionsSuccessResponse.md)
- [Filter](docs/Model/Filter.md)
- [FilterExpression](docs/Model/FilterExpression.md)
- [GenericError](docs/Model/GenericError.md)
- [GenericSuccessBoolResponse](docs/Model/GenericSuccessBoolResponse.md)
- [GetNotificationHistoryRequestBody](docs/Model/GetNotificationHistoryRequestBody.md)
- [GetSegmentsSuccessResponse](docs/Model/GetSegmentsSuccessResponse.md)
- [LanguageStringMap](docs/Model/LanguageStringMap.md)
- [Notification](docs/Model/Notification.md)
- [NotificationAllOf](docs/Model/NotificationAllOf.md)
- [NotificationHistorySuccessResponse](docs/Model/NotificationHistorySuccessResponse.md)
- [NotificationSlice](docs/Model/NotificationSlice.md)
- [NotificationTarget](docs/Model/NotificationTarget.md)
- [NotificationWithMeta](docs/Model/NotificationWithMeta.md)
- [NotificationWithMetaAllOf](docs/Model/NotificationWithMetaAllOf.md)
- [Operator](docs/Model/Operator.md)
- [OutcomeData](docs/Model/OutcomeData.md)
- [OutcomesData](docs/Model/OutcomesData.md)
- [PlatformDeliveryData](docs/Model/PlatformDeliveryData.md)
- [PlatformDeliveryDataEmailAllOf](docs/Model/PlatformDeliveryDataEmailAllOf.md)
- [PlatformDeliveryDataSmsAllOf](docs/Model/PlatformDeliveryDataSmsAllOf.md)
- [PropertiesBody](docs/Model/PropertiesBody.md)
- [PropertiesDeltas](docs/Model/PropertiesDeltas.md)
- [PropertiesObject](docs/Model/PropertiesObject.md)
- [Purchase](docs/Model/Purchase.md)
- [RateLimitError](docs/Model/RateLimitError.md)
- [Segment](docs/Model/Segment.md)
- [SegmentData](docs/Model/SegmentData.md)
- [SegmentNotificationTarget](docs/Model/SegmentNotificationTarget.md)
- [StartLiveActivityRequest](docs/Model/StartLiveActivityRequest.md)
- [StartLiveActivitySuccessResponse](docs/Model/StartLiveActivitySuccessResponse.md)
- [Subscription](docs/Model/Subscription.md)
- [SubscriptionBody](docs/Model/SubscriptionBody.md)
- [SubscriptionNotificationTarget](docs/Model/SubscriptionNotificationTarget.md)
- [TemplateResource](docs/Model/TemplateResource.md)
- [TemplatesListResponse](docs/Model/TemplatesListResponse.md)
- [TransferSubscriptionRequestBody](docs/Model/TransferSubscriptionRequestBody.md)
- [UpdateApiKeyRequest](docs/Model/UpdateApiKeyRequest.md)
- [UpdateLiveActivityRequest](docs/Model/UpdateLiveActivityRequest.md)
- [UpdateLiveActivitySuccessResponse](docs/Model/UpdateLiveActivitySuccessResponse.md)
- [UpdateTemplateRequest](docs/Model/UpdateTemplateRequest.md)
- [UpdateUserRequest](docs/Model/UpdateUserRequest.md)
- [User](docs/Model/User.md)
- [UserIdentityBody](docs/Model/UserIdentityBody.md)
- [WebButton](docs/Model/WebButton.md)

Authorization
-------------

[](#authorization)

All the OneSignal endpoints require either an *app\_key* or *user\_key* tokens for authorization. It is recommended to set up both of those keys during the initial config initialization so that you don't need to worry about which endpoint requires app\_key and which user\_key. You can get the value of these keys from your app dashboard and [user settings](https://app.onesignal.com/profile) pages.

### organization\_api\_key

[](#organization_api_key)

- **Type**: Bearer authentication

### rest\_api\_key

[](#rest_api_key)

- **Type**: Bearer authentication

Author
------

[](#author)

- API version: `5.3.0`
    - Package version: `5.3.0`

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance88

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Recently: every ~72 days

Total

8

Last Release

55d ago

Major Versions

2.2.1 → 5.1.0-beta12025-06-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/86f22f031697c07dfcaa0661fef35180d0dd65f1a52ca5dd73a54d2feede7741?d=identicon)[sherwinski](/maintainers/sherwinski)

![](https://www.gravatar.com/avatar/94b1cbb391358cd7b479d7215c7e8f29ddcfccb244749ed9c4b576f921b4eb69?d=identicon)[OneSignal](/maintainers/OneSignal)

---

Top Contributors

[![sherwinski](https://avatars.githubusercontent.com/u/15919091?v=4)](https://github.com/sherwinski "sherwinski (12 commits)")[![kesheshyan](https://avatars.githubusercontent.com/u/796200?v=4)](https://github.com/kesheshyan "kesheshyan (11 commits)")[![fadi-george](https://avatars.githubusercontent.com/u/6709400?v=4)](https://github.com/fadi-george "fadi-george (4 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (3 commits)")[![carnevalle](https://avatars.githubusercontent.com/u/54747?v=4)](https://github.com/carnevalle "carnevalle (1 commits)")[![onesignal-deploy](https://avatars.githubusercontent.com/u/16770098?v=4)](https://github.com/onesignal-deploy "onesignal-deploy (1 commits)")[![emawby](https://avatars.githubusercontent.com/u/13123372?v=4)](https://github.com/emawby "emawby (1 commits)")[![mreyeszaz](https://avatars.githubusercontent.com/u/38500562?v=4)](https://github.com/mreyeszaz "mreyeszaz (1 commits)")[![jkasten2](https://avatars.githubusercontent.com/u/645861?v=4)](https://github.com/jkasten2 "jkasten2 (1 commits)")

---

Tags

phpapisdkrestonesignal

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/onesignal-onesignal-php-api/health.svg)

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

###  Alternatives

[ory/hydra-client

Documentation for all of Ory Hydra's APIs.

17435.9k](/packages/ory-hydra-client)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

1204.3k](/packages/zenditplatform-zendit-php-sdk)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1829.2k2](/packages/huaweicloud-huaweicloud-sdk-php)[ory/hydra-client-php

Documentation for all of Ory Hydra's APIs.

1710.8k](/packages/ory-hydra-client-php)

PHPackages © 2026

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