PHP code example of sibappco / onesignal-client

1. Go to this page and download the library: Download sibappco/onesignal-client 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/ */

    

sibappco / onesignal-client example snippets


        use Sibapp\Onesignal\OneSignalClient;
        use Sibapp\Onesignal\OneSignalMessage;
        use Sibapp\Onesignal\OneSignalReceiver;
        Route::get('/', function (OneSignalClient $oneSignalClient) {
        	$oneSignallMessagge=new OneSignalMessage();
        	$oneSignalReceiver=new OneSignalReceiver();
        	$oneSignallMessagge->body("TEST BODY");
        	$oneSignallMessagge->subject("TEST SUBJECT");
        	$oneSignalReceiver->setToAll();
        	$oneSignalClient->createNotification($oneSignallMessagge,$oneSignalReceiver);
        });
        

    use Sibapp\Onesignal\OneSignalClient;
    Route::get('/', function (OneSignalClient $oneSignalClient) {
    	$oneSignalClient->getNotification('Notification ID');
    });
    

        use Sibapp\Onesignal\OneSignalClient;
        Route::get('/', function (OneSignalClient $oneSignalClient) {
        	$oneSignalClient->cancelNotification('Notification ID');
        

    use Sibapp\Onesignal\OneSignalClient;
    Route::get('/', function (OneSignalClient $oneSignalClient) {
    	$oneSignalClient->viewDevice('Player ID');
    });