Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

roccozanni/growler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Growler - A pure PHP Growl notification library

Build Status

Class loading

If you have installed the package with composer, it will provide autoloading feature:

require_once 'vendor/.composer/autoload.php';

Otherwise, if you already use in your project a PSR-0 compliant autoloader, simply register the "Growler" namespace:

// This is based on the Symfony2 Class Loader
$loader->registerNamespace('Growler', 'growler/src');

Otherwise, a basic autoloader is included in the Growler distribution:

require_once 'growler/src/Growler/ClassLoader.php';
Growler\ClassLoader::register();

UDP protocol

Historical versions of Growl (< 1.3), listen to the UDP port 9887 for incoming messages that represents notifications to display

The protocol is very simple:

  • supports only title and message, no custom icon
  • on the same socket you can send as many messages as you want, no response from the other side

The UDP procol implementation is feature-complete.

This is an example for creating a UDP based transport:

$connection  = new Growler\Connection("udp", "localhost", 9887);
$transport   = new Growler\Transport\Udp($connection);

GNTP protocol

From Growl 1.3 has been introduced the new TCP-based GNTP protocol.

GNTP is a protocol to allow two-way communication between applications and centralized notification systems such as Growl for Mac OS X and to allow two-way communication between two machines running centralized notification systems for notification forwarding purposes.

Missing GNTP features:

  • Message encryption. In the current version of Growl (1.3.2), encryption is not supported yet. Is only defined in the protocol specification
  • Subscribing and callbacks.

This is an example for creating a GNTP based transport:

$connection  = new Growler\Connection("tcp", "localhost", 23053);
$transport   = new Growler\Transport\Gntp($connection);

Password protection

Either the UDP and the GNTP protocols, support server password. Just add the password as the second parameter in transport creation:

$transport   = new Growler\Transport\Gntp($connection, "secret");

Other TODOs

  • Error handling
  • A Facade for simpler use out-of-the-box

Examples

Code samples are available in the "examples" directory

About

Growler - PHP Growl notification library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages