Skip to content

AleksandarSavic95/exponent-server-sdk-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exponent-server-sdk-php

Server-side library for working with Expo push notifications using PHP

Latest Stable Version License Total Downloads

Usage

  • Require the package in your project

      composer require alymosul/exponent-server-sdk-php
    
  • In a php file

      require_once __DIR__.'/vendor/autoload.php';
      
      $interestDetails = ['unique identifier', 'ExponentPushToken[unique]'];
      
      // You can quickly bootup an expo instance
      $expo = \ExponentPhpSDK\Expo::normalSetup();
      
      // Subscribe the recipient to the server
      $expo->subscribe($interestDetails[0], $interestDetails[1]);
      
      // Build the notification data
      $notification = ['body' => 'Hello World!'];
      
      // Notify an interest with a notification
      $expo->notify($interestDetails[0], $notification);
    

Data can be added to notifications by providing it as a JSON object. For example

    // Build the notification data
    $notification = ['body' => 'Hello World!', 'data'=> json_encode(array('someData' => 'goes here'))];

TODO

  • Need to create tests

Laravel driver

About

Server-side library for working with Expo push notifications using PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%