aranytoth/yii2-onesignal
Composer 安装命令:
composer require aranytoth/yii2-onesignal
包简介
This is composer dependency update based on vasadibt/yii2-onesignal
README 文档
README
This is a restful api to onesignal.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist vasadibt/yii2-onesignal "dev-master"
or add
"vasadibt/yii2-onesignal": "dev-master"
to the require section of your composer.json file.
Config
Once the extension is installed, you have to configure the api component:
'components' => [ 'onesignal' => [ 'class' => '\vasadibt\onesignal\OneSignal', 'appId' => 'your-app-id-hash-code', 'appAuthKey' => 'SetYourAppAuthKey', 'userAuthKey' => 'SetYourUserAuthKey', 'enabled' => YII_ENV_PROD ? true : false, ], ],
Usage
Call api endpoints:
Yii::$app->onesignal->apps->getAll(); Yii::$app->onesignal->devices->getOne('asd-asd-asd-asd-asd-asd'); Yii::$app->onesignal->devices->getAll(); Yii::$app->onesignal->notifications->add([ 'include_player_ids' => ['player-hash-code-12345-123456789'], 'contents' => ["en" => 'New message'], ]); Yii::$app->onesignal->notifications->add([ 'included_segments' => ['All'], 'contents' => ["en" => 'New message'], ]);
统计信息
- 总下载量: 481
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-10