PHP code example of dipendentincloud / onesignal-laravel

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

    

dipendentincloud / onesignal-laravel example snippets


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

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

    OneSignal::sendNotificationToAll(
        "Some Message",
        $url = null,
        $data = null,
        $buttons = null,
        $schedule = null
    );

    OneSignal::sendNotificationUsingTags(
        "Some Message",
        array(
            ["key" => "email", "relation" => "=", "value" => "[email protected]"],
            ["key" => "email", "relation" => "=", "value" => "[email protected]"],
            ...
        ),
        $url = null,
        $data = null,
        $buttons = null,
        $schedule = null
    );

    OneSignal::sendNotificationUsingTags(
        "Some Message",
        array(
            ["key" => "session_count", "relation" => ">", "value" => '2'],
            ["key" => "first_session", "relation" => ">", "value" => '2000'],
        ),
        $url = null,
        $data = null,
        $buttons = null,
        $schedule = null
    );

    OneSignal::sendNotificationToUser(
        "Some Message",
        $userId,
        $url = null,
        $data = null,
        $buttons = null,
        $schedule = null
    );

    OneSignal::sendNotificationToExternalUser(
        "Some Message",
        $userId,
        $url = null,
        $data = null,
        $buttons = null,
        $schedule = null
    );

    OneSignal::sendNotificationToSegment(
        "Some Message",
        $segment,
        $url = null,
        $data = null,
        $buttons = null,
        $schedule = null
    );

    OneSignal::sendNotificationCustom($parameters);

    OneSignal::async()->sendNotificationCustom($parameters);

php artisan vendor:publish --tag=config