定制 vasiliy_liao/notification 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vasiliy_liao/notification

Composer 安装命令:

composer require vasiliy_liao/notification

包简介

use to push notification for android/ios phone

README 文档

README

You can quickly use this package to build your Push Notification Server by PHP.

1. How to install the package

require:{
   ...
    "vasiliy_liao/notification":"*"
   ...
}

OR

composer require vasiliy_liao/notification

2. How to use the package

<?php

require 'vendor/autoload.php';

$config = [
    'apn_server' => 'dev',
    'apn_gem_file' => 'pem dir',
    'apn_password' => 'pem password',
    'gcm_key' => 'api key'
];

$apns = new VasiliyTW\Notification\PushAPNS(
        $config['apn_gem_file'],
        $config['apn_password'],
        $config['apn_server']);

$gcm = new VasiliyTW\Notification\PushGCM($config['gcm_key']);

$apns->connect(); //or $apns->alwaysConnect();
$apns->push('device_token','your_notification_info');

//push one device
$gcm->push('device_token','your_notification_info');
//push multi device
$gcm->push('device_token_array','your_notification_info');

3. Simple Example

you can easily use to push Notification for Your Android/IOS Phone.

require 'vendor/autoload.php';

$config = [
    'apn_server' => 'dev',
    'apn_gem_file' => '/var/www/test.pem',
    'apn_password' => '12345678',
    'gcm_key' => '87654321'
];

$apns = new VasiliyTW\Notification\PushAPNS(
    $config['apn_gem_file'],
    $config['apn_password'],
    $config['apn_server']);

$gcm = new VasiliyTW\Notification\PushGCM($config['gcm_key']);

$apns->connect(); //or $apns->alwaysConnect();
$apns->push('1234455',
    [
        'body' => 'just test message',
        'detail' =>
            [
                'id' => 1
            ]
    ]);

//push one device
$gcm->push('1234455',
    [
        'message' => 'Test',
        'detail' =>
            [
                'id' => 1
            ]
    ]);
//push multi device
$gcm->push(
    [
        '12345',
        '67890'
    ],
    [
        'message' => 'Test',
        'detail' =>
            [
                'id' => 1
            ]
    ]);

统计信息

  • 总下载量: 42
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-11-02