cmuench/lib.notify

Linux desktop notification library

1.1.1 2015-02-01 00:16 UTC

This package is auto-updated.

Last update: 2024-11-24 05:27:35 UTC


README

The library can be extended by adapter. Currently we deliver one default adapter which needs external tool "notify-send".

Installation

composer.phar require "cmuench/lib.notify=dev-master"

External tool installation

Ubuntu

Can be installed via apt (universal package)

sudo apt-get install libnotify-bin

Supported Adapters

  • Standard: external libnotify command
  • PHP Module DBus (pecl install dbus)

Example-Usage

<?php

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

use \CMuench\LibNotify;
use \CMuench\LibNotify\Adapter\DbusModuleAdapter; // dbus adapter if used

$client = new LibNotify\Client();
// $client = new LibNotify\Client(new DbusModuleAdapter());  // use php dbus module

$client->send(
    'Summary',
    'Body text',
    LibNotify\Urgency\Level::CRITICAL(),
    LibNotify\Icon\Library\Gnome\Status::DIALOG_WARNING
);

Icon Library

The icon library was generated by this bash commands:

find /usr/share/icons/gnome/32x32/actions -type f -name "*.png" -exec bash -c 'echo -n "const "; basename {} .png | tr "[:lower:]" "[:upper:]" | tr "-" "_" | tr "\n" "="; echo -n \"{}\"; echo ";" ' \; >> <path_to_php_file>
find /usr/share/icons/Humanity/categories/32 -type f -name "*.svg" -exec bash -c 'echo -n "const "; basename {} .svg | tr "[:lower:]" "[:upper:]" | tr "-" "_" | tr "\n" "="; echo -n \"{}\"; echo ";" ' \; >> <path_to_php_file>