pushed/pushed-php-api-client

Pushed平台API客户端库

dev-master 2015-01-24 22:41 UTC

This package is not auto-updated.

Last update: 2024-09-24 01:05:40 UTC


README

安装方法

使用 Composer(推荐)

  1. "pushed/pushed-php-api-client": "dev-master" 添加到 composer.json 文件的 "require": 部分。(了解更多关于 composer 的信息这里。)

  2. 在您的根目录中,从您的 shell 运行 composer update pushed/pushed-php-api-client --no-dev 命令。

手动安装

  1. 下载并解压最新的 Pushed官方PHP API客户端源代码 到您的PHP项目中。

  2. 使用提供的自动加载器在您的应用程序中引入它。

    require_once "/path/to/Pushed/Pushed.php";

基本用法

应用程序通知

$params = [
	'app_key' => 'your_app_key',
	'app_secret' => 'your_app_secret',
	'content' => 'Your notification content',
];
		
(new Pushed())->push->toApp($params);

频道通知

$params = [
	'app_key' => 'your_app_key',
	'app_secret' => 'your_app_secret',
	'content' => 'Your notification content',
	'target_alias' => 'your_channel_alias',
];

(new Pushed())->push->toChannel($params);

用户通知

$params = [
	'app_key' => 'your_app_key',
	'app_secret' => 'your_app_secret',
	'content' => 'Your notification content',
	'target_alias' => 'destination_user_alias',
	'access_token' => 'destination_user_access_token',
];

(new \Pushed())->push->toUser($params);

Pushed-ID通知

$params = [
	'app_key' => 'your_app_key',
	'app_secret' => 'your_app_secret',
	'content' => 'Your notification content',
	'target_alias' => 'destination_user_alias',
	'pushed_id' => 'destination_user_pushed_id',	
];

(new \Pushed())->push->toUser($params);

关于Pushed

Pushed是您的个人通知中心,提供超级棒的服务。该应用程序允许您在发生重要事件时接收通知。了解更多关于Pushed的信息:pushed.co。如果您发现错误或认为可以改进此脚本,请随时通过dev@pushed.co联系我们。

Packagist网站:https://packagist.org.cn/packages/pushed/pushed-php-api-client