PHP >= 5.4
JoliNotif is a PHP library to send notifications to your desktop directly from your script. It takes care of using the right command available, without having to worry if you're running on Linux, Windows or MacOS.
For example, if you have a long running PHP task - like executing a large test suite, launching a deployment script - you can use JoliNotif to inform your users that a task just finished.
Use Composer to install JoliNotif in your project:
composer require "jolicode/jolinotif"
Use the NotifierFactory
to create a Notifier
according to which notifiers
are available on your system, then use it to send your notification:
use Joli\JoliNotif\Notification;
use Joli\JoliNotif\NotifierFactory;
// Create a Notifier (or null if no notifier supported)
$notifier = NotifierFactory::create();
if ($notifier) {
// Create your notification
$notification =
(new Notification())
->setTitle('Notification title')
->setBody('This is the body of your notification')
->setIcon(__DIR__.'/path/to/your/icon.png')
;
// Send it
$notifier->send($notification);
}
Discover more by reading the docs:
You can see the current and past versions using one of the following:
- the
git tag
command - the releases page on Github
- the file listing the changes between versions
And finally some meta documentation:
- All contributors
- This project was originally inspired by mikaelbr/node-notifier
JoliNotif is licensed under the MIT License - see the LICENSE file for details.