PHP code example of jobstreet / js-push-notification

1. Go to this page and download the library: Download jobstreet/js-push-notification library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jobstreet / js-push-notification example snippets




$client = new JSPNClient(array(
    'applicationId' => 'YOUR_APPLICATION_ID',
    'isSandbox'     => true
));

$response = $client->publishMessage(12345, 'This is the notification message', array(
    'customParameter1' => 'parameter'
), array(
    'notificationOptions' => 'options'
));

if($response == 1) {
    echo 'Successfully publish message';
}
else {
    echo 'Failed to publish message. Error message ' . $response->error->message;
}

define('JSPN_CONFIG_PATH', 'path/to/config.php');



return array(
    'applicationId' => 'YOUR_APPLICATION_ID',
    'isSandbox'     => true
);