dyaa/pushover

此包已被弃用,不再维护。未建议替代包。

Laravel 5 Pushover 包

安装: 19,008

依赖者: 0

建议者: 0

安全性: 0

星标: 49

关注者: 6

分支: 16

开放问题: 1

类型:laravel-package

1.4.1 2016-11-24 06:24 UTC

This package is not auto-updated.

Last update: 2020-01-24 15:18:50 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version Dependency Status License

这是一个用于来自 https://pushover.net/ 的 Android 和 iOS 推送通知服务的 Laravel 5 包。

**如果您发现了任何错误或有任何增强建议,欢迎您通过 Issue 或 Pull Request 进行提交。

内容

安装

如果您仍在使用 laravel 4.1,请使用 1.3.0 版本。

要获取 dyaa/pushover 的最新版本,只需在您的 composer.json 文件中添加它。

"dyaa/pushover": "dev-master"

之后,您需要运行 composer update 来下载最新版本并更新自动加载器。

或者

composer require dyaa/pushover:dev-master

一旦安装了 dyaa/pushover,您需要注册服务提供者。为此,打开 app/config/app.php 并将以下内容添加到 providers 键中。

'Dyaa\Pushover\PushoverServiceProvider',

接下来,将此外观添加到 app/config/app.php

'Dyaa\Pushover\Facades\Pushover',

要在您的 L5 应用中使用它

use Dyaa\Pushover\Facades\Pushover;

配置

创建 app/config/pushover.php 并用您的 Token 和从 https://pushover.net/ 获取的用户 Key 填充。

return [
    'token' => 'App Token',
    'user_key' => 'User Key',
];

用法

现在您可以使用此包如下

设置消息(必需

Pushover::push($title, $message);

设置链接(可选)

Pushover::url($url, $title);

设置回调(可选)

Pushover::callback($callbackURL);

设置声音(可选)支持的提醒声音 https://pushover.net/api#sounds

Pushover::sound($sound);

设置设备名称(可选)

Pushover::device($device);

设置是否将消息作为 HTML 发送(可选)默认为 1

Pushover::html($html);

设置时间戳(可选)默认为 time()

Pushover::timestamp($timestamp);

设置优先级(可选)有关优先级的更多信息 https://pushover.net/api#priority

Pushover::priority($priority, $retry, $expire);

打开调试模式(可选)

Pushover::debug(true);

发送消息(必需

Pushover::send();

所有其他信息请在此处查看 https://pushover.net/api

命令

从版本 1.2.0 开始,它支持 Artisan 命令,但首先请确保您已经正确完成了 配置

您可以运行

php artisan list

并您将找到

pushover
pushover:send               Pushover Command

要发送 Pushover 消息,您可以使用以下方式(标题和消息是必需的

php artisan pushover:send YourTitle YourMessage

要打开调试模式,只需在命令行末尾添加

--debug

要设置声音,可以添加 “可选”

--sound=YourSound

要了解支持的声音,请在此处查看 https://pushover.net/api#sounds

要设置设备名称 “可选”

--device=YourDeviceName

发送URL (可选)

--url=http://www.example.com/

为URL设置标题 (可选)

--urltitle=UrlTitle

设置优先级消息,您可以在此处了解更多关于优先级消息的信息:https://pushover.net/api#priority (可选)

--priority=1

设置优先级重试时间(秒) 默认值为 60 (可选)

--retry=60

设置优先级过期时间(秒) 默认值为 356 (可选)

--expire=356

设置消息是否以HTML格式发送。默认值为 1 (可选) 注意:消息体需要用引号括起来。

--html=1

许可证

版权所有(c)2017 Dyaa Eldin Moustafa。根据MIT许可证许可。