filp / nod
PHP中的通知(notify-send、growl等)。
dev-master
2012-08-29 13:19 UTC
Requires
- php: >5.3.0
Requires (Dev)
- mageekguy/atoum: dev-master
Suggests
- mageekguy/atoum: Nod\Adapter\AtoumWriter(optional) requires the atoum unit testing framework.
This package is not auto-updated.
Last update: 2024-09-14 12:41:36 UTC
README
PHP中的通知(notify-send, growl, etc
)就像这样。
##示例
让Nod
确定最佳适配器(目前不推荐,仅适用于某些Linux环境)。
#!/usr/bin/env php <?php $notification = new Nod\Notification; $notification ->setTitle('My rad notification') ->setMessage('Check it.') ->setUrgency('high') ->setExpiry(3000) ->setIcon('emblem-favorite.png') ->send();
明确地为Nod
提供一个适配器进行工作。
#!/usr/bin/env php <?php use Nod\Adapter\Terminal as TerminalAdapter; $notification = new Nod\Notification(new TerminalAdapter); $notification ->setTitle('Look at ya') ->setMessage('Let me see what ya got') // you can also specify the expiry directly in the send() method: ->send(5000);
创建自己的适配器就像实现Nod\Adapter\AdapterInterface
一样简单。
<?php namespace Nod\Adapter; interface AdapterInterface { /* bool */ public function canNotify(); /* bool */ public function process($title, $message, $urgency, $expiry, $icon); }
##安装
Nod可以通过composer(packagist页面)使用,只需将filp/nod
添加到您的composer.json
文件中即可。
{ "require" : { "filp/nod" : "dev-master" } }
Nod库可以直接通过composer自动加载器加载,或者使用任何兼容PSR-0
的自动加载器。
##待办事项、愿望清单等
- 平台支持(MacOS growl、Windows growl等)。
- 单元测试(即将推出!)
- 更多适配器,用于各种奇特的工具。