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

Laravel Desktop Notifier Laravel Package

nunomaduro/laravel-desktop-notifier

Desktop notifications for Laravel Artisan commands via a JoliNotif wrapper. Adds a notify() macro to your console commands to send messages (with optional icon) on Linux, Windows, and macOS. Requires PHP 8.1+.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package via Composer:

    composer require nunomaduro/laravel-desktop-notifier
    

    No service provider or config file is needed — the package uses Laravel's auto-discovery.

  2. Start using it in your Artisan commands by calling $this->notify() in the handle() method:

    $this->notify('Deployment complete', 'Production build finished successfully.');
    

    On first use, the system will attempt to display a native desktop notification (requires running on a desktop environment — not in pure CLI headless contexts like production CI).

  3. Add an optional icon for richer visuals:

    $this->notify('Success', 'Task completed', resource_path('img/icon.png'));
    

Implementation Patterns

  • In long-running commands: Use to signal progress milestones without requiring constant terminal monitoring:

    $this->notify('Step 1', 'Database migration started');
    // ...
    $this->notify('Step 2', 'Database migration completed', '✅');
    
  • In deployment/CI hooks: Trigger notifications from local deploy scripts or interactive deploy commands (e.g., php artisan deploy) to alert you when background tasks finish.

  • With custom icons: Define reusable icon paths (e.g., resource_path('icons/app.png')) and wrap in a helper trait or base command class for consistency:

    protected function success(string $title, string $body): void
    {
        $this->notify($title, $body, resource_path('icons/success.png'));
    }
    
  • Conditional notifications: Skip desktop alerts when not in an interactive or GUI-enabled environment (e.g., in CI):

    if ($this->output->isVerbose()) {
        $this->notify('Debug', 'Configuration reloaded');
    }
    

Gotchas and Tips

  • No notification in non-GUI environments: Desktop notifications only appear if the system has a graphical environment (e.g., local dev machine). In headless servers (e.g., Docker containers, production servers), calls will silently no-op or emit warnings depending on OS.

  • ⚙️ Quiet mode override: If your command is invoked with --quiet, $this->notify() still attempts to show desktop alerts — consider wrapping critical calls:

    if (! $this->option('quiet')) {
        $this->notify(...);
    }
    
  • 🖼️ Icon requirements vary by OS:

    • macOS: PNG recommended (≤ 512×512 px).
    • Windows: .ico or .png; large icons may be clipped.
    • Linux: Supports PNG; desktop environment (e.g., GNOME, KDE) must support desktop notifications.
  • 🔁 Not for end-user alerts: This package is strictly for developer/local workflow feedback, not production user-facing notifications.

  • 🔌 Hook into events: Use in artisan bootstrapping or event listeners to notify on infrastructure events (e.g., cache clear, queue drain) during development:

    Event::listen(JobProcessed::class, fn () => $this->notify('Job', 'Processed successfully'));
    
  • 🧪 Test safety: Desktop notifiers do not throw exceptions by default — handle failures manually if logging/alerting is needed:

    $success = $this->notify('Test', 'Alert');
    // No return value — rely on OS behavior; no built-in success check
    
  • ⏱️ Upgrade early for Laravel compatibility: As seen in changelog, new releases often add compatibility ahead of Laravel versions — check for updates before upgrading Laravel core.

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