jolicode / jolinotif
Send desktop notifications on Windows, Linux, MacOS.
Fund package maintenance!
Tidelift
Installs: 7 721 710
Dependents: 43
Suggesters: 2
Security: 0
Stars: 1 402
Watchers: 48
Forks: 93
Open Issues: 1
Requires
- php: >=8.1
- jolicode/php-os-helper: ^0.1.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- symfony/deprecation-contracts: ^3
- symfony/process: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- symfony/finder: ^5.4 || ^6.0 || ^7.0
- symfony/phpunit-bridge: ^5.4 || ^6.0 || ^7.0
Suggests
- ext-ffi: Needed to send notifications via libnotify on Linux
README
About JoliNotif
JoliNotif is a cross-platform PHP library to display desktop notifications. It works on Linux, Windows or macOS.
Requires PHP >= 8.1 (support for PHP 5 was available in version 1.x, for PHP 7.0 and 7.1 in version < 2.1.0, for PHP 7.2 and 7.3 in version < 2.4.0, for PHP < 8.0 in version 2.6.0).
Note
This library can not be used in a web context (FPM or equivalent). Use it in your CLI scripts or in a CRON
Installation
Use Composer to install JoliNotif in your project:
composer require "jolicode/jolinotif"
Usage
include __DIR__.'/vendor/autoload.php'; use Joli\JoliNotif\Notification; use Joli\JoliNotif\DefaultNotifier; $notifier = new DefaultNotifier(); // Create your notification $notification = (new Notification()) ->setTitle('Notification title') ->setBody('This is the body of your notification') ->setIcon(__DIR__.'/path/to/your/icon.png') ->addOption('subtitle', 'This is a subtitle') // Only works on macOS (AppleScriptDriver) ->addOption('sound', 'Frog') // Only works on macOS (AppleScriptDriver & TerminalNotifierDriver) ; // Send it $notifier->send($notification);
A shell executable is also provided to use JoliNotif from CLI:
jolinotif --title "Hello" --body "World"
Further documentation
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:
Credits
- All contributors
- This project was originally inspired by mikaelbr/node-notifier
License
JoliNotif is licensed under the MIT License - see the LICENSE file for details.