PHP code example of rocketfirm / yii2-onesignal

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

    

rocketfirm / yii2-onesignal example snippets




return [
	'components' => [
		// ...

		'onesignal' => [
			'class' => '\rocketfirm\onesignal\OneSignal',
			'appId' => 'ONESIGNAL_APP_ID',
			'apiKey' => 'ONESIGNAL_API_KEY',
		]
	]
]


\Yii::$app->onesignal->players()->add($deviceType, $options);


\Yii::$app->onesignal->notifications()->create($message, $options)