PHPackages                             luniumall/expo-server-sdk-php - 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. luniumall/expo-server-sdk-php

ActiveLibrary

luniumall/expo-server-sdk-php
=============================

Server-side library for working with Expo using PHP

v2.1.1(1y ago)064MITPHPPHP &gt;=7.2

Since Aug 27Pushed 1y agoCompare

[ Source](https://github.com/LUNIU-MALL/expo-server-sdk-php)[ Packagist](https://packagist.org/packages/luniumall/expo-server-sdk-php)[ Docs](https://github.com/ctwillie/expo-server-sdk-php)[ RSS](/packages/luniumall-expo-server-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (6)Used By (0)

expo-server-sdk-php [![tests](https://github.com/ctwillie/expo-server-sdk-php/actions/workflows/tests.yml/badge.svg)](https://github.com/ctwillie/expo-server-sdk-php/actions/workflows/tests.yml/badge.svg) [![codecov](https://camo.githubusercontent.com/3422dbd4e78d7969384f9601a11f82727ce5eb4aa0a6facae0eece0760387059/68747470733a2f2f636f6465636f762e696f2f67682f637477696c6c69652f6578706f2d7365727665722d73646b2d7068702f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d38514f334e4c31333152)](https://codecov.io/gh/ctwillie/expo-server-sdk-php) [![GitHub](https://camo.githubusercontent.com/eb85bfe8b9e58b52bf4d92d542de6ab2793839b8f1e5db99bd508a19ed66ace7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f637477696c6c69652f6578706f2d7365727665722d73646b2d7068703f636f6c6f723d253233303043454431)](https://camo.githubusercontent.com/eb85bfe8b9e58b52bf4d92d542de6ab2793839b8f1e5db99bd508a19ed66ace7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f637477696c6c69652f6578706f2d7365727665722d73646b2d7068703f636f6c6f723d253233303043454431)
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#expo-server-sdk-php---)

Server-side library for working with Expo using PHP.

If you have any problems with the code in this repository, feel free to [open an issue](https://github.com/ctwillie/expo-server-sdk-php/issues) or make a PR!

Table of Contents- [Testing](#testing)
- [Installation](#installation)
- [Use Cases](#use-cases)
- [Composing a Message](#composing-a-message)
- [Sending a Message](#sending-a-push-notification)
- [Channel Subscriptions](#channel-subscriptions)
- [Expo Responses](#expo-responses)
- [Handling Unregistered Devices](#handling-unregistered-devices)
- [Retrieving Push Receipts](#retrieving-push-receipts)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [License](#license)

Testing
-------

[](#testing)

You can run the test suite via composer:

```
composer test
```

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

[](#installation)

You can install the package via composer:

```
composer require ctwillie/expo-server-sdk-php
```

Use Cases
---------

[](#use-cases)

This package was written with two main use cases in mind.

1. Sending push notification messages to one or more recipients, then you're done! The most obvious use case.
2. And channel subscriptions, used to subscribe one or more tokens to a channel, then send push notifications to all tokens subscribed to that channel. Subscriptions are persisted until a token unsubscribes from a channel. Maybe unsubscribing upon the end users request.

Keep this in mind as you decide which is the best use case for your back end.

Composing a message
-------------------

[](#composing-a-message)

Compose a push notification message to send using options from the [Expo docs](https://docs.expo.dev/push-notifications/sending-notifications/#message-request-format).

```
use ExpoSDK\ExpoMessage;

/**
 * Create messages fluently and/or pass attributes to the constructor
 */
$message = (new ExpoMessage([
    'title' => 'initial title',
    'body' => 'initial body',
]))
    ->setTitle('This title overrides initial title')
    ->setBody('This notification body overrides initial body')
    ->setData(['id' => 1])
    ->setChannelId('default')
    ->setBadge(0)
    ->playSound();
```

Sending a push notification
---------------------------

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

Compose a message then send to one or more recipients.

```
use ExpoSDK\Expo;
use ExpoSDK\ExpoMessage;

/**
 * Composed messages, see above
 * Can be an array of arrays, ExpoMessage instances will be made internally
 */
$messages = [
    [
        'title' => 'Test notification',
        'to' => 'ExponentPushToken[xxxx-xxxx-xxxx]',
    ],
    new ExpoMessage([
        'title' => 'Notification for default recipients',
        'body' => 'Because "to" property is not defined',
    ]),
];

/**
 * These recipients are used when ExpoMessage does not have "to" set
 */
$defaultRecipients = [
    'ExponentPushToken[xxxx-xxxx-xxxx]',
    'ExponentPushToken[yyyy-yyyy-yyyy]'
];

(new Expo)->send($messages)->to($defaultRecipients)->push();
```

Channel subscriptions
---------------------

[](#channel-subscriptions)

Subscribe tokens to a channel, then push notification messages to that channel. Subscriptions are persisted internally in a local file so you don't have to worry about this yourself. Unsubscribe the token from the channel at any time to stop messages to that recipient.

> ⚠️ **If you are are running multiple app servers**: Be very careful here! Channel subscriptions are stored in an internal local file. Subscriptions will not be shared across multiple servers.

```
/**
 * Specify the file driver to persist subscriptions internally.
 */
use ExpoSDK\Expo;

$expo = Expo::driver('file');

// composed message, see above
$message;

$recipients = [
    'ExponentPushToken[xxxx-xxxx-xxxx]',
    'ExponentPushToken[yyyy-yyyy-yyyy]'
];

// name your channel anything you'd like
$channel = 'news-letter';
// the channel will be created automatically if it doesn't already exist
$expo->subscribe($channel, $recipients);

$expo->send($message)->toChannel($channel)->push();

// you can unsubscribe one or more recipients from a channel.
$expo->unsubscribe($channel, $recipients);
```

Expo responses
--------------

[](#expo-responses)

Get the data returned from successful responses from the Expo server.

```
$response = $expo->send($message)->to($recipients)->push();

$data = $response->getData();
```

Handling unregistered devices
-----------------------------

[](#handling-unregistered-devices)

Expo provides a macro for handling tokens that have DeviceNotRegistered error in the Expo response. You can register a callback before sending your messages to handle these unregistered tokens.

You only need to register the handler once as it will be applied to all Expo instances.

```
use ExpoSDK\Expo;

Expo::addDevicesNotRegisteredHandler(function ($tokens) {
    // this callback is called once and receives an array of unregistered tokens
});

$expo1 = new Expo();
$expo1->send(...)->push(); // will call your callback

$expo2 = new Expo();
$expo2->send(...)->push(); // will also call your callback
```

Retrieving push receipts
------------------------

[](#retrieving-push-receipts)

Retrieve the push receipts using the ticket ids from the Expo server.

```
$ticketIds = [
    'xxxx-xxxx-xxxx-xxxx',
    'yyyy-yyyy-yyyy-yyyy'
];

$response = $expo->getReceipts($ticketIds);
$data = $response->getData();
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Cedric Twillie](https://github.com/ctwillie)
- [All Contributors](../../contributors)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.1% 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 ~389 days

Total

4

Last Release

549d ago

Major Versions

v1.2 → v2.1.12024-11-06

PHP version history (2 changes)v1.0PHP &gt;=7.3

v2.1.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/71191282684f4ea06f3da9e4333bee66741adf30572d3263d3545359a3cfd471?d=identicon)[luniumall](/maintainers/luniumall)

---

Top Contributors

[![ctwillie](https://avatars.githubusercontent.com/u/32856661?v=4)](https://github.com/ctwillie "ctwillie (54 commits)")[![meng1204](https://avatars.githubusercontent.com/u/14936452?v=4)](https://github.com/meng1204 "meng1204 (9 commits)")[![cedrictwillie](https://avatars.githubusercontent.com/u/98113373?v=4)](https://github.com/cedrictwillie "cedrictwillie (2 commits)")[![karlyn33](https://avatars.githubusercontent.com/u/7232113?v=4)](https://github.com/karlyn33 "karlyn33 (1 commits)")[![nathan-klei](https://avatars.githubusercontent.com/u/194522499?v=4)](https://github.com/nathan-klei "nathan-klei (1 commits)")[![allan-simon](https://avatars.githubusercontent.com/u/213167?v=4)](https://github.com/allan-simon "allan-simon (1 commits)")[![torocsik-marton](https://avatars.githubusercontent.com/u/22094773?v=4)](https://github.com/torocsik-marton "torocsik-marton (1 commits)")[![dorkyboi](https://avatars.githubusercontent.com/u/23461412?v=4)](https://github.com/dorkyboi "dorkyboi (1 commits)")[![eexit](https://avatars.githubusercontent.com/u/57098?v=4)](https://github.com/eexit "eexit (1 commits)")

---

Tags

phpexpoexpo-server-sdk-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/luniumall-expo-server-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/luniumall-expo-server-sdk-php/health.svg)](https://phpackages.com/packages/luniumall-expo-server-sdk-php)
```

###  Alternatives

[ctwillie/expo-server-sdk-php

Server-side library for working with Expo using PHP

63686.3k1](/packages/ctwillie-expo-server-sdk-php)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[kinde-oss/kinde-auth-php

Kinde PHP SDK for authentication

2369.5k3](/packages/kinde-oss-kinde-auth-php)

PHPackages © 2026

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