Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jolicode/JoliNotif
:computer: Send notifications to your desktop directly from your PHP script
https://github.com/jolicode/JoliNotif
desktop-notifications notifier notify php
Last synced: 3 months ago
JSON representation
:computer: Send notifications to your desktop directly from your PHP script
- Host: GitHub
- URL: https://github.com/jolicode/JoliNotif
- Owner: jolicode
- License: mit
- Created: 2015-03-01T11:50:10.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-05-03T20:29:01.000Z (6 months ago)
- Last Synced: 2024-05-16T07:05:20.513Z (6 months ago)
- Topics: desktop-notifications, notifier, notify, php
- Language: PHP
- Homepage: http://jolicode.com/blog/desktop-notification-in-php
- Size: 2.89 MB
- Stars: 1,326
- Watchers: 47
- Forks: 87
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
- awesome-php - JoliNotif - A cross-platform library for desktop notification (support for Growl, notify-send, toaster, etc) (Table of Contents / Notifications)
- awesome-php-cn - JoliNotif - 用于桌面通知的跨平台库(支持 咆哮,通知-发送,烤面包机等) (目录 / 通知 Notifications)
- awesome-projects - JoliNotif - A cross-platform library for desktop notification (support for Growl, notify-send, toaster, etc) (PHP / Notifications)
- awesome-php - JoliNotif - A cross-platform library for desktop notification (support for Growl, notify-send, toaster, etc) (Table of Contents / Notifications)
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](doc/04-cron-usage.md)## Installation
Use [Composer](http://getcomposer.org/) to install JoliNotif in your project:
```shell
composer require "jolicode/jolinotif"
```## Usage
```php
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)
;// Send it
$notifier->send($notification);
```A [shell executable](doc/05-cli-usage.md) is also provided to use JoliNotif from CLI:
```shell
jolinotif --title "Hello" --body "World"
```## Further documentation
Discover more by reading the docs:
* [Basic usage](doc/01-basic-usage.md)
* [Notification](doc/02-notification.md)
* [Drivers](doc/03-drivers.md)
* [CRON usage](doc/04-cron-usage.md)
* [CLI usage](doc/05-cli-usage.md)You can see the current and past versions using one of the following:
* the `git tag` command
* the [releases page on Github](https://github.com/jolicode/JoliNotif/releases)
* the file listing the [changes between versions](CHANGELOG.md)And finally some meta documentation:
* [versioning and branching models](VERSIONING.md)
* [contribution instructions](CONTRIBUTING.md)## Credits
* [All contributors](https://github.com/jolicode/JoliNotif/graphs/contributors)
* This project was originally inspired by [mikaelbr/node-notifier](https://github.com/mikaelbr/node-notifier)## License
JoliNotif is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details.