安装
composer require xeemosion/xeepush
提示
- 如果安装失败请切换为官网源
- 因为阿里云composer代理停止了从composer官方源同步数据,所以目前无法使用阿里云composer代理升级到最新,
- 请使用以下命令 composer config -g --unset repos.packagist 恢复使用composer官方数据源
调用方式一
php
use Xeemosion\Xeepush\XeeClient;
$client = new XeeClient("你的 appcode");
$data = [
'channel_id' => "你的通道 id",
'title' => "推送到Telegram",
'push_data' => "
📦 <b>新订单通知</b> 📦
📝 交易号:%s
📝 订单号:<code>%s</code> 👈 <b>点击复制</b>
💰 支付金额:%.2f CNY
📈 实际支付金额:%.2f %s
📊 钱包地址:<code>%s</code>
🕰️ 订单创建时间:%s
🕰️ 支付成功时间:%s
",];
$res = $client->Telegram($data)->request();
if ($res['code'] != 200) {
//返回错误信息
return $res['message'];
}
//推送成功后返回的数据
print_r($res['data']);
调用方式二
php
use Xeemosion\Xeepush\XeeClient;
$client = new XeeClient("你的 appcode");
$res = $client->Telegram()
->set_channel_id("通道 id")
->set_title("推送到Telegram")
->set_push_data('推送的内容是hello world')
->request();
if ($res['code'] != 200) {
//返回错误信息
return $res['message'];
}
//推送成功后返回的数据
print_r($res['data']);
推送到邮件email
php
use Xeemosion\Xeepush\XeeClient;
$client = new XeeClient("你的 appcode");
$res = $client->email()
->set_channel_id("通道 id")
->set_title("标题")
->set_push_data('推送的内容是hello world')
->request();
if ($res['code'] != 200) {
//返回错误信息
return $res['message'];
}
//推送成功后返回的数据
print_r($res['data']);
推送到钉钉dingTalk
php
use Xeemosion\Xeepush\XeeClient;
$client = new XeeClient("你的 appcode");
$res = $client->dingTalk()
->set_channel_id("通道 id")
->set_title("标题")
->set_push_data('推送的内容是hello world')
->request();
if ($res['code'] != 200) {
//返回错误信息
return $res['message'];
}
//推送成功后返回的数据
print_r($res['data']);
推送到企业微信wechatCom
php
use Xeemosion\Xeepush\XeeClient;
$client = new XeeClient("你的 appcode");
$res = $client->wechatCom()
->set_channel_id("通道 id")
->set_title("标题")
->set_push_data('推送的内容是hello world')
->request();
if ($res['code'] != 200) {
//返回错误信息
return $res['message'];
}
//推送成功后返回的数据
print_r($res['data']);
推送到Telegram
php
use Xeemosion\Xeepush\XeeClient;
$client = new XeeClient("你的 appcode");
$res = $client->Telegram()
->set_channel_id("通道 id")
->set_title("推送到Telegram")
->set_push_data('推送的内容是hello world')
->request();
if ($res['code'] != 200) {
//返回错误信息
return $res['message'];
}
//推送成功后返回的数据
print_r($res['data']);
--- | -- |
---|---|
![]() | ![]() |