imdhemy/expo-notifications

PHP expo push notifications client

0.05 2021-01-30 09:25 UTC

This package is auto-updated.

Last update: 2024-11-29 06:10:51 UTC


README

PHP expo push notifications client

Installation

You can install the package via composer

composer require imdhemy/expo-notifications

Usage

use Imdhemy\Expo\Client;
use Imdhemy\Expo\Messages\Message;
use Imdhemy\Expo\Messages\MessageList;

$tokens = [
    'ExponentPushToken[aaaaaaaaaaaaaaaaaaaaaa]',
    'ExponentPushToken[bbbbbbbbbbbbbbbbbbbbbb]',
];
$title = 'hello';
$body = 'world';

$message = new Message($title, $body);
$message->addManyPushTokens($tokens);

$list = MessageList::init()->addMessage($message);

$client = Client::create();
$tickets = $client->push($list);