zortje / boxcar-notifications-php
用于向Boxcar账户发送通知的Boxcar API包装器
1.0.0
2015-10-03 11:32 UTC
Requires
- php: >=5.5
- lib-curl: *
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-09-14 18:09:40 UTC
README
这是一个用于向Boxcar账户发送通知的Boxcar API包装器,除了cURL库外没有其他依赖。
安装
建议的安装方法是使用Composer。
{ "require": { "zortje/boxcar-notifications-php": "~1.0" } }
使用方法
$boxcar = new \Zortje\BoxcarNotifications\Boxcar('secret_access_token'); $boxcar->setSourceName('ACME'); $boxcar->setSound('notifier-1'); $boxcar->setIconUrl('http://new.boxcar.io/images/rss_icons/boxcar-64.png'); $boxcar->setOpenUrl('http://maps.google.com/maps?q=cupertino'); $notification = new \Zortje\BoxcarNotifications\Notification('Message title', '<b>Bold</b> content text.'); $boxcar->push($notification);
访问令牌
'secret_access_token'
在上述示例中。您的访问令牌可以在Boxcar全局设置面板中找到(不是注册的Boxcar电子邮件地址)。
标题
'Message title'
在上述示例中。通知的标题。最大长度为255个字符。
内容
'<b>Bold</b> content text.'
在上述示例中。通知的内容。可以是文本或HTML。最大长度为4 Kb。
源名称
'ACME'
在上述示例中。这是在收件箱中显示的简短源名称。如果省略,则默认为“自定义通知”。
声音
'notifier-1'
在上述示例中。如果省略,则使用通用声音。请参阅以下支持的声音列表。
图标URL
'http://new.boxcar.io/images/rss_icons/boxcar-64.png'
在上述示例中。要在Boxcar收件箱中显示的图标。
打开URL
'http://maps.google.com/maps?q=cupertino'
在上述示例中。如果定义,当用户从通知中心打开通知时,Boxcar将重定向接收者到该URL。
支持的声音
以下声音可以使用。
- beep-crisp
- beep-soft
- bell-modern
- bell-one-tone
- bell-simple
- bell-triple
- bird-1
- bird-2
- boing
- cash
- clanging
- detonator-charge
- digital-alarm
- done
- echo
- flourish
- harp
- light
- magic-chime
- magic-coin
- notifier-1
- notifier-2
- notifier-3
- orchestral-long
- orchestral-short
- score
- success
- up
确认
遵循Boxcar帮助中提供的API规范构建。这篇文章。
免责声明
我以任何方式都与Boxcar无关。