PHP code example of davidxu / yii2-igt

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

    

davidxu / yii2-igt example snippets


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;
	}

}

php composer.phar