Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Jolinotif Laravel Package

jolicode/jolinotif

Cross-platform PHP library for sending desktop notifications from CLI scripts or cron jobs on Linux, macOS, Windows, and WSL. Create notifications with title, body, icon, and OS-specific options, or use the bundled jolinotif CLI command.

View on GitHub
Deep Wiki
Context7

Basic usage

Create a notifier and sending a notification

JoliNotif provides a DefaultNotifier class which is the main entrypoint of the library. It's main goal is to provide a simple way to send a desktop notification without having to care about the platform you're running on. It will work whether you're on Linux, Windows or macOS.

use Joli\JoliNotif\DefaultNotifier;
use Joli\JoliNotif\Notification;

$notifier = new DefaultNotifier();

$notifier->send(new Notification());

And you're done!

Internally, the notifier will use each driver's priority to determine the best one available on your system. For example, some driver have a low priority because they don't support some notification options. So if a better driver is available, it will be used.

[!NOTE] In case no driver is supported or if an error happens during notification sending, the send method will return false.

[!TIP] If you want to log when an error happens or if no driver is supported, you can also pass an instance of Psr\Log\LoggerInterface as the first parameter of the DefaultNotifier's constructor.

Create and configure your notification

Create a notification is as simple as instantiating a Notification and setting the option you want to use:

use Joli\JoliNotif\Notification;

$notification =
    (new Notification())
    ->setBody('The notification body')
    ->setTitle('The notification title')
    ->addOption('subtitle', 'This is a subtitle') // Only works on macOS (AppleScriptDriver)
    ->addOption('sound', 'Frog') // Only works on macOS (AppleScriptDriver & TerminalNotifierDriver)
    ->addOption('url', 'https://google.com') // Only works on macOS (TerminalNotifierDriver)
;

As you can see, the notification class provides a fluent API.

Next readings

Previous pages:

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport