PHP code example of andreseko / onesignal

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

    

andreseko / onesignal example snippets


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

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

$onesignal = new \AndreSeko\OneSignal\OneSignal('APP_ID', 'REST_API_KEY');
$onesignal->setTitle('MY APP')
    ->setSubTitle('My best app ever')
    ->setMessage('My cool message')
    ->sendNotification();

$onesignal = new \AndreSeko\OneSignal\OneSignal('APP_ID', 'REST_API_KEY');
$onesignal->setTitle('MY APP')
    ->setSubTitle('My best app ever')
    ->setMessage('My cool message')
    ->setPlataform(OneSignal::IOS)
    ->setPlataform(OneSignal::ANDROID, false)
    ->setPlataform(OneSignal::WEB, false)
    ->configureIos('my_custom_sound.caf')
    ->sendNotification();

$onesignal = new \AndreSeko\OneSignal\OneSignal('APP_ID', 'REST_API_KEY');
$onesignal->setTitle('MY APP')
    ->setSubTitle('My best app ever')
    ->setMessage('My cool message')
    ->setPlataform(OneSignal::ANDROID)
    ->setPlataform(OneSignal::IOS, false)
    ->setPlataform(OneSignal::WEB, false)
    ->configureAndroid('my_custom_sound')
    ->sendNotification();

$onesignal = new \AndreSeko\OneSignal\OneSignal('APP_ID', 'REST_API_KEY');
$response = $onesignal->getNotifications();
bash
php artisan vendor:publish --tag=config