f1ll0y/php-os-gui-notify
最新稳定版本:3.0.0
Composer 安装命令:
composer require f1ll0y/php-os-gui-notify
包简介
Send desktop os notifications on Windows, Linux, MacOS.
README 文档
README
forked from jolicode/JoliNotif
JoliNotif is a cross-platform PHP library to display desktop notifications. It works on Linux, Windows or MacOS.
Requires PHP >= 7.4 (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).
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
Use the NotifierFactory to create the correct Notifier (adapted to your OS),
then use it to send your notification:
include __DIR__.'/vendor/autoload.php'; use Joli\JoliNotif\Notification; use Joli\JoliNotif\NotifierFactory; // Create a Notifier $notifier = NotifierFactory::create(); // 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 (AppleScriptNotifier) ->addOption('sound', 'Frog') // Only works on macOS (AppleScriptNotifier) ; // 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 tagcommand - 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.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-01
