Yii2 component for OneSignal.com integration
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
helpers
.gitignore
LICENSE
OneSignal.php
README.md
composer.json
composer.lock

README.md

yii2-onesignal

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.