PHP Push Notification

Trying to get notifications to work - using PHP SDK (GitHub - Alymosul/exponent-server-sdk-php: Server-side library for working with Expo push notifications using PHP)

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

CODE

  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.

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