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.8.0(1w ago)34216.9k↓33.6%13[1 issues](https://github.com/OneSignal/onesignal-php-api/issues)2PHPPHP ^7.3 || ^8.0CI passing

Since Jan 22Pushed 1w ago28 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 2d ago

READMEChangelog (10)Dependencies (12)Versions (19)Used By (2)

OneSignal
=========

[](#onesignal)

> **Building with an AI agent or LLM?** See [AGENTS.md](https://github.com/OneSignal/onesignal-php-api/blob/main/AGENTS.md) for an agent-oriented integration guide — authentication, calling conventions, idempotent retries, and the full API reference.

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 .

- API version: 5.8.0
- Package version: 5.8.0

Requirements
------------

[](#requirements)

PHP 7.3 and later.

Installation
------------

[](#installation)

Add the following to `composer.json`:

```
{
  "require": {
    "onesignal/onesignal-php-api": "^5.3"
  }
}
```

Then run `composer update`.

Configuration
-------------

[](#configuration)

Every SDK requires authentication via API keys. Two key types are available:

- **REST API Key** — required for most endpoints (sending notifications, managing users, etc.). Found in your app's **Settings &gt; Keys &amp; IDs**.
- **Organization API Key** — only required for organization-level endpoints like creating or listing apps. Found in **Organization Settings**.

> **Warning:** Store your API keys in environment variables or a secrets manager. Never commit them to source control.

```
use onesignal\client\api\DefaultApi;
use onesignal\client\Configuration;
use GuzzleHttp;

$config = Configuration::getDefaultConfiguration()
    ->setRestApiKeyToken('YOUR_REST_API_KEY')
    ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY');

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

Send a push notification
------------------------

[](#send-a-push-notification)

```
use onesignal\client\model\Notification;
use onesignal\client\model\StringMap;

$content = new StringMap();
$content->setEn('Hello from OneSignal!');

$headings = new StringMap();
$headings->setEn('Push Notification');

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

$response = $client->createNotification($notification);
echo 'Notification ID: ' . $response->getId();
```

Send an email
-------------

[](#send-an-email)

```
$notification = new Notification();
$notification->setAppId('YOUR_APP_ID');
$notification->setEmailSubject('Important Update');
$notification->setEmailBody('Hello!This is an HTML email.');
$notification->setIncludedSegments(['Subscribed Users']);
$notification->setChannelForExternalUserIds('email');

$response = $client->createNotification($notification);
```

Send an SMS
-----------

[](#send-an-sms)

```
$content = new StringMap();
$content->setEn('Your SMS message content here');

$notification = new Notification();
$notification->setAppId('YOUR_APP_ID');
$notification->setContents($content);
$notification->setIncludedSegments(['Subscribed Users']);
$notification->setChannelForExternalUserIds('sms');
$notification->setSmsFrom('+15551234567');

$response = $client->createNotification($notification);
```

Full API reference
------------------

[](#full-api-reference)

The complete list of API endpoints and their parameters is available in the [DefaultApi documentation](https://github.com/OneSignal/onesignal-php-api/blob/main/docs/Api/DefaultApi.md).

For the underlying REST API, see the [OneSignal API reference](https://documentation.onesignal.com/reference).

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance98

Actively maintained with recent releases

Popularity47

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity52

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

Recently: every ~16 days

Total

13

Last Release

10d 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 (17 commits)")[![kesheshyan](https://avatars.githubusercontent.com/u/796200?v=4)](https://github.com/kesheshyan "kesheshyan (11 commits)")[![onesignal-deploy](https://avatars.githubusercontent.com/u/16770098?v=4)](https://github.com/onesignal-deploy "onesignal-deploy (8 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (8 commits)")[![fadi-george](https://avatars.githubusercontent.com/u/6709400?v=4)](https://github.com/fadi-george "fadi-george (4 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)")[![carnevalle](https://avatars.githubusercontent.com/u/54747?v=4)](https://github.com/carnevalle "carnevalle (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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

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

Huawei Cloud SDK for PHP

1830.8k2](/packages/huaweicloud-huaweicloud-sdk-php)

PHPackages © 2026

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