PHP Push Notification


Trying to get notifications to work - using PHP SDK (

I’m using Codeigniter if that helps at all so I have the require once pointing to the Expo.php file.


  require_once APPPATH.'third_party/exponent-server-sdk-php/lib/Expo.php';
  //require_once __DIR__.'/vendor/autoload.php';   [commented out]

  $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);

ERROR #1: PHP doesn’t like the “??”

$this->ch = $this->ch?? curl_init();

ERROR #2: if I remove the “??” part it throws the following error.

Fatal error : Class ‘ExponentPhpSDK\ExpoRegistrar’ not found

Any help getting this to load without any errors would be great.

closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.