filp/nod

Notifications in PHP (notify-send, growl, etc) like that.

Maintainers

👁 filp

Package info

github.com/filp/nod

Homepage

pkg:composer/filp/nod

Statistics

Installs: 87

Dependents: 0

Suggesters: 0

Stars: 52

Open Issues: 0

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.

Provides

None

Conflicts

None

Replaces

None

MIT e7b91128e9fb99fbdbf2a4dfca35da8ee2c4300b

growlnotificationsnotifydbusnotify-send

This package is not auto-updated.

Last update: 2026-06-20 21:18:26 UTC


README

Notifications in PHP (notify-send, growl, etc) like that.

##Examples

Letting Nod figure out the best Adapter to use (not recommend ATM, only works with some Linux environments):

#!/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();

Explicitly giving Nod an Adapter to work with:

#!/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);

Creating your own Adapters is also as easy as implementing Nod\Adapter\AdapterInterface:

<?php

namespace Nod\Adapter;
interface AdapterInterface
{
 /* bool */ public function canNotify();
 /* bool */ public function process($title, $message, $urgency, $expiry, $icon);
}

##Installation

Nod is available through composer (packagist page), just drop filp/nod into your composer.json and you're good to go:

{
 "require" : {
 "filp/nod" : "dev-master"
 }
}

The Nod library can be loaded directly through the composer autoloader, or with any PSR-0 compatible autoloader.

##TODOs, wishlist, etc

  • Platform support (OSX growl, Windows growl, etc)
  • Unit tests (soon!)
  • More adapters for all sorts of zany stuff.