Linux desktop notification library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
MIT-LICENSE.txt
composer.json
readme.md

readme.md

PHP based Linux Notification library

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>