Clone wiki

Notify / Home

Desktop Notifications for PHP

Here lies a small PHP extension that exposes the functionality of the libnotify library to PHP-world. If you're writing a desktop application in PHP and you want to present a notification to the user, this is the library for you! All for just £199.99! No refunds. Offer is subject to terms and conditions.

Tested with notify-osd, but should work for all implementations of the desktop notifications specification.

Documentation

The extension is split into two classes: Notify, and Notification. The Notification class is under the Notify namespace. The documentation written here is for the current stable version of the extension.

Current stable version: 0.4

\Notify

The static class providing initialisation and utility functions.

Methods:

  • \Notify::init( string $app_name );
    • Initialises libnotify. This must be called before the library is used!
  • \Notify::uninit( void );
    • Uninitialises libnotify.
  • \Notify::isInitted( void );
    • Returns a boolean indicating whether libnotify has been initialised.
  • \Notify::getAppName( void );
    • Returns the string provided to \Notify::init().
  • \Notify::getServerCaps( void );
    • Returns an array of the server capabilities.
  • \Notify::getServerInfo( void );
    • Returns an array of the server information.

\Notify\Notification

This class represents the actual notification object, and is the meat of the extension.

Constants:

  • \Notify\Notification::EXPIRES_DEFAULT
  • \Notify\Notification::EXPIRES_NEVER
  • \Notify\Notification::URGENCY_LOW
  • \Notify\Notification::URGENCY_NORMAL
  • \Notify\Notification::URGENCY_CRITICAL

Methods:

Note: parameters in [ ] are optional.

  • \Notify\Notification::construct( string $summary[, string $body[, string $icon[, GtkWidget $widget]]] );
    • Creates a new notification object. Can be attached to a GtkWidget.
  • \Notify\Notification::newWithStatusIcon( string $summary, GtkStatusIcon $icon[, string $body[, string $icon]]);
  • \Notify\Notification::update( string $summary[, string $body[, string $icon]]);
    • Updates the notification text and icon.
  • \Notify\Notification::attachToWidget( GtkWidget $widget );
    • Attaches the notification to a GtkWidget. If $widget is NULL, it is detached.
  • \Notify\Notification::attachToStatusIcon( GtkStatusIcon $icon );
    • Attaches the notification to a GtkWidget. If $icon is NULL, it is detached.
  • \Notify\Notification::show( void );
    • Tells the notification server to display the notification.
  • \Notify\Notification::close( void );
    • Tells the notification to close the notification.

Updated