2017 © Pedro Peláez
 

library notifier

Desktop Notifier Library.

image

mehr-als-nix/notifier

Desktop Notifier Library.

  • Saturday, March 26, 2016
  • by siad007
  • Repository
  • 2 Watchers
  • 2 Stars
  • 49 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Notifier

Build Status Code Climate Test Coverage Dependency Status HHVM Status, (*1)

Desktop Notifications

Notifier acts as a wrapper for desktop notify applications on different operating systems., (*2)

Following notify wrappers are build in and would make checks to chose one of:, (*3)

  • notify-send (Linux)
  • terminal-notifier (Mac)
  • toast.exe (Windows) nels-o/toaster

Install via composer

Add a dependency on mehr-als-nix/notifier to your project's composer.json file., (*4)

Here is a minimal example of a manually created composer.json file that just defines a dependency on mehr-als-nix/notifier, (*5)

{
    "require": {
        "mehr-als-nix/notifier": "~2"
    }
}

For PHP environments prior to version 5.6 use instead:, (*6)

{
    "require": {
        "mehr-als-nix/notifier": "~1"
    }
}

Usage

Example:, (*7)

   \MehrAlsNix\Notifier\Notify::getInstance()
       ->sendMessage('Notification', 'This is a desktop message!');

Extend

Custom class has to extend from \MehrAlsNix\Notifier\Notification, (*8)

<?php

namespace \Custom\Notifier;

class GrowlNotifier extends \MehrAlsNix\Notifier\Notification
{
    /**
     * Notify with `growlnotify`.
     *
     * @param string $title
     * @param string $message
     * @param string $icon    optional
     *
     * @return void
     */
    protected function notify($title, $message, $icon = null)
    {
        $icon = is_string($icon) ? $icon : $this->icon;
        $this->execute("growlnotify -t '{$title}' -m '{$message}' --image '{$icon}'");
    }

    /**
     * @inheritdoc
     *
     * @return bool
     */
    public function isAvailable()
    {
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            return (bool) $this->execute('where.exe growlnotify');
        }

        return (bool) $this->execute('which growlnotify');
    }
}

And can then be used like:, (*9)

    \MehrAlsNix\Notifier\Notify::getInstance('\Custom\Notifier\GrowlNotifier')
        ->sendMessage('Notification', 'This is a desktop message!');

or, (*10)

    \MehrAlsNix\Notifier\Notify::getInstance('\Custom\Notifier\GrowlNotifier')
       ->setTitle('Notification')
       ->setMessage('This is a desktop message!')
       ->setIcon('/path/to/icon.png')
       ->send();

The Versions

26/03 2016

dev-master

9999999-dev http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

26/03 2016

dev-develop

dev-develop http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

17/08 2015

v2.0.0-beta.3

2.0.0.0-beta3 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

16/08 2015

v2.0.0-beta.2

2.0.0.0-beta2 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

  • php >=5.6
  • nels-o/toaster dev-master

 

The Development Requires

by Siad Ardroumli

16/08 2015

v2.0.0-beta.1

2.0.0.0-beta1 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Siad Ardroumli

09/08 2015

v1.0.0

1.0.0.0 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Siad Ardroumli

09/08 2015

v0.0.1-beta.2

0.0.1.0-beta2 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Siad Ardroumli

09/08 2015

v0.0.1-beta.1

0.0.1.0-beta1 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Siad Ardroumli

09/08 2015

v0.0

0.0.0.0 http://mehralsnix.github.io/Notifier

Desktop Notifier Library.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Siad Ardroumli