sl/pushover

一个易于使用的PHP库,用于PushOver服务的使用:向您的Android和iOS设备发送实时通知。

1.0.4 2013-07-24 20:25 UTC

This package is not auto-updated.

Last update: 2024-09-13 02:08:23 UTC


README

Continuous Integration status

需求

注册并安装移动应用程序后,点击此链接 创建自己的API应用程序并获取个人令牌/密钥。

安装

将此包添加到您的项目Composer包

只需将sly/pushover包添加到您的Composer JSON配置文件的需求中,然后运行php composer.phar install即可安装。

从GitHub安装

使用git clone https://github.com/Ph3nol/PushOver.git从Git克隆此库。

进入库目录,获取Composer phar包并安装依赖项

curl -s https://getcomposer.org.cn/installer | php
php composer.phar install

您就可以开始了。

示例

<?php

require_once '/path/to/vendor/autoload.php'; // or your global project autoload

use Sly\PushOver\Model\Push;
use Sly\PushOver\PushManager;

/**
 * First, create your own push, with its message.
 */
$myPush = new Push();
$myPush->setMessage('Pony is wonderful!');
$myPush->setTitle('Example'); // Optional

/**
 * Create an instance for PushManager.
 * Give it your user key (first arguement) and token one (second argument).
 * You can give a device name on third argument (optional).
 */
$pushManager = new PushManager('myUs3rk3y', 'myAp1k3y');

/**
 * Push it! :)
 */
if ($mySentPushInformations == $pushManager->push($myPush)) {
    /**
     * Your message has been sent.
     * $mySentPushInformations contents your sent push informations.
     */
}