PHP code example of dreamonkey / laravel-onesignal-rest-api

1. Go to this page and download the library: Download dreamonkey/laravel-onesignal-rest-api 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/ */

    

dreamonkey / laravel-onesignal-rest-api example snippets


$app->register( \Dreamonkey\OneSignal\OneSignalServiceProvider::class );
class_alias( 'Dreamonkey\OneSignal\OneSignalFacade', 'OneSignal' );

$response = OneSignal::postNotification([
    "tags"                  =>  [ ["key" => "myKey", "relation" => "=", "value" => 1 ] ],
    "contents"              => ["en" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean et iaculis enim. Sed egestas porttitor laoreet."],
    "headings"              => ["en" => "Aliquam consectetur odio sed"],
]);