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.
Install the package via Composer:
composer require jolicode/jolinotif
Then get started with a minimal usage example in a CLI script:
use Joli\Notif\NotifierFactory;
require_once __DIR__ . '/vendor/autoload.php';
$notifier = NotifierFactory::create();
$notifier->notify('Build Complete', 'All tests passed! ✅', __DIR__ . '/assets/icon.png');
Start by testing with php -r "..." in your terminal to verify notifications appear. The factory automatically detects your platform (macOS, Linux, Windows/WSL) and selects the appropriate backend.
Note (v3.3.0): PHP 8.5 is now fully supported. As of this release, PHP 8.2 is no longer supported—ensure your project targets PHP 8.3, 8.4, or 8.5. Composer will enforce this via ^8.3 in the package requirements.
NotifierInterface (resolved via NotifierFactory::create()) into service classes (e.g., BuildRunner, DeploymentTask) instead of coupling to OS-specific logic.if ($notifier->isSupported()) for environments like headless servers or CI where desktop notifications may be unavailable or undesirable.$notifier->notify(
title: 'Deployment Success',
body: 'Release v2.4 deployed to production 🚀',
icon: '/opt/app/assets/rocket.png',
actionLabel: 'View Logs',
actionCallback: fn() => shell_exec('tail -f /var/log/app.log')
);
nohup or background jobs to notify long-running processes (e.g., php generate-report.php &).$notifier = NotifierFactory::create(['drivers' => ['win', 'libnotify', 'terminal']]);
notify-send is the fallback driver, but custom icons require absolute paths. Relative paths (e.g., ./icon.png) often fail silently—use realpath().wslu installed (wslnotify backend). Ensure wslview is available for icon paths.isSupported() before notifying in production scripts..icns, Linux expects .png, and Windows uses .ico. Normalize via a helper:
$icon = match(PHP_OS_FAMILY) {
'Darwin' => realpath(__DIR__ . '/icon.icns'),
'Linux' => realpath(__DIR__ . '/icon.png'),
'Windows' => realpath(__DIR__ . '/icon.ico'),
default => null,
};
DriverInterface and registering via NotifierFactory::registerDriver($driver). Useful for team-specific integrations (e.g., Mattermost, Slack desktop notifications).NotifierInterface—no OS dependencies needed.jolicode/jolinotif package now requires ^8.3. Check composer.json for require.php constraints, and update CI pipelines accordingly.How can I help you explore Laravel packages today?