davidxu/yii2-igt

The iGetui SDK integration for the Yii2 framework and PHP 5.4

1.0.4 2018-10-09 11:51 UTC

This package is auto-updated.

Last update: 2024-11-10 05:03:44 UTC


README

Based on Getui SDK (PHP) 4.0.1.0

Functions

  1. Silent transmission message to single user
  2. Normal transmission message to single user
  3. Normal transmission message to all users

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require davidxu/yii2-igt

or add

"davidxu/yii2-igt": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

use davidxu\igt\Getui;
class PushController extends Controller
{
	/**
	 * Send normal transmission message to all app users
	 * Will play a sound and a badge (1) will display
	 * 
	 *   $content = [
	 *       'payloadTitle' => 'transmission Title',
	 *       'payloadContet' => 'transmission content here',
	 *   ];
	 *    $payload = Json::encode($content);
	 *    $alertTitle = 'Attention Please';
	 *    $alert_body = 'Alert Body Here, you have a unread message';
	 * 
	 * @param mixed $content
	 * @param string $alertBody
	 * @param string $alertTitle
	 * @return mixed|null
	 *
	 * Sample of return result
	 * {
	 *    "result": "ok",
	 *    "contentId": "OSA-1031_tAvRLPhf5Q9d2IAADSKOn9"
	 *  }
	 *
	 */
	public function actionSystemMsg($content, $alertBody, $alertTitle)
	{
	    $getui = new Getui();
	    $getui->appId = '<appId>';
	    $getui->appkey = '<appKey'>;
	    $getui->$masterSecret = '<masterSecret'>;
	    $response = $getui->pushTransmissionAlertToApp($content, $alertBody, $alertTitle);
	    return $response;
	}

}

Remark

Please refer to Getui official documentation and Apple Local and Remote Notification Programming Guide

This package should can be used for other frameworks also.

Any other question please contact me at david.xu.uts@163.com