PHP code example of jmrieger / onesignal-laravel

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

    

jmrieger / onesignal-laravel example snippets


'providers' => [
	// ...
	jmrieger\OneSignal\OneSignalServiceProvider::class
];

'aliases' => [
   	// ...
   	'OneSignal' => jmrieger\OneSignal\OneSignalFacade::class
   ];

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

php artisan vendor:publish

$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"],
]);