PHP code example of abgit / onesignal

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

    

abgit / onesignal example snippets


$onesignal = new abgit\onesignal( 'app_id', 'app_key' );

$notification = [
            'headings' => [
                'en' => 'Title'
            ],
            'contents' => [
                'en' => 'Notification message'
            ],
            'subtitle' => [
                'en' => 'subtitle'
            ],
            'channel_for_external_user_ids' => 'push',
            '

$onesignal = new abgit\onesignal( 'app_id', 'app_key' );

$notification = [
            'email_subject' => 'hello',
            'template_id' => '77ca0b25-13b8-....',
            'channel_for_external_user_ids' => 'email',
            '