composer require sureshchand/onesignal-notification
<?php
require "vendor/autoload.php";
$api_id = 'API_ID';
$rest_api_key = 'REST_API_KEY';
$pushNotification = new \Suresh\Onesignal\Notification($api_id, $rest_api_key);
<?php
$pushNotification->setBody('English Message')
->setSegments('All')
->prepare()
->send();
<?php
$pushNotification->setBody('English Message')
->setSegments('Active Users')
->prepare()
->send();
<?php
$pushNotification->setBody('English Message')
->setFilter([
['field' => 'tag', 'key' => 'level', 'relation' => '>', 'value' => '10'],
['operator' => 'OR'],
['field' => 'amount_spent', 'relation' => '>', 'value' => '0']
])
->prepare()
->send();
<?php
$pushNotification->setBody('English Message')
->setPlayersId([
'PLAYER_ID',
'ANOTHER_PLAYER_ID'
])
->prepare()
->send();