rocketfirm / yii2-onesignal
Yii2 component for OneSignal.com integration
Installs: 27 167
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 4
Open Issues: 1
Requires
- linslin/yii2-curl: ^1.0.8
- yiisoft/yii2: ^2.0
This package is auto-updated.
Last update: 2024-11-16 04:22:45 UTC
README
Yii2 component for OneSignal.com integration. Any contribution is highly encouraged!
Installation
Preferred way to install is through Composer.
composer require rocketfirm/yii2-onesignal
Configuration
Add following code to your configuration file (main.php):
<?php return [ 'components' => [ // ... 'onesignal' => [ 'class' => '\rocketfirm\onesignal\OneSignal', 'appId' => 'ONESIGNAL_APP_ID', 'apiKey' => 'ONESIGNAL_API_KEY', ] ] ]
Usage
After adding onesignal component to your project you can now simply add players to your OneSignal application by running following code:
<?php \Yii::$app->onesignal->players()->add($deviceType, $options);
Run following command to send notifications:
<?php \Yii::$app->onesignal->notifications()->create($message, $options)
Visit official onesignal.com documentation for more details.