PHPackages                             soloterm/notify-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. soloterm/notify-laravel

ActiveLibrary[CLI &amp; Console](/categories/cli)

soloterm/notify-laravel
=======================

Laravel integration for soloterm/notify - send desktop notifications from Artisan commands.

v0.1.0(4mo ago)41MITPHPPHP ^8.1CI passing

Since Dec 16Pushed 4mo agoCompare

[ Source](https://github.com/soloterm/notify-laravel)[ Packagist](https://packagist.org/packages/soloterm/notify-laravel)[ RSS](/packages/soloterm-notify-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Notify for Laravel
==================

[](#notify-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2320a5aaeda410d1ef31f94c0f42e9840056922ee05093ea5b1f1828232c2f54/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c6f7465726d2f6e6f746966792d6c61726176656c2e737667)](https://packagist.org/packages/soloterm/notify-laravel)[![Total Downloads](https://camo.githubusercontent.com/c8cc8743ae65e5cc281a6989bc8b77556054ad4f902cd3af51b04d647b776ffa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6c6f7465726d2f6e6f746966792d6c61726176656c2e737667)](https://packagist.org/packages/soloterm/notify-laravel)[![License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

Laravel integration for [soloterm/notify](https://github.com/soloterm/notify) - send desktop notifications from Artisan commands via terminal OSC escape sequences.

This package was built to support [Solo](https://github.com/soloterm/solo), your all-in-one Laravel command to tame local development.

**OSC Notifications (Ghostty)****OSC Notifications (iTerm2)**[![Ghostty OSC notification](art/ghostty-osc.png)](art/ghostty-osc.png)[![iTerm2 OSC notification](art/iterm-osc.png)](art/iterm-osc.png)**macOS Fallback****Fireworks (iTerm2)**[![macOS fallback notification](art/mac-fallback.png)](art/mac-fallback.png)[![iTerm2 fireworks](art/fireworks.png)](art/fireworks.png)**Progress Bars (Ghostty)****Progress Bars (iTerm2)**[![Ghostty progress bar](art/ghostty-progress.png)](art/ghostty-progress.png)[![iTerm2 progress bar](art/iterm-progress.png)](art/iterm-progress.png)Installation
------------

[](#installation)

```
composer require soloterm/notify-laravel --dev
```

The service provider will be auto-discovered by Laravel.

Quick Start
-----------

[](#quick-start)

```
use SoloTerm\Notify\Laravel\Facades\Notify;

// Simple notification
Notify::send('Build complete!');

// Semantic methods
Notify::success('All tests passed');
Notify::error('Build failed');
Notify::warning('Low disk space');
Notify::info('Background task started');
```

Artisan Command
---------------

[](#artisan-command)

```
# Simple notification
php artisan notify "Build complete!"

# With a title
php artisan notify "All tests passed" --title="Tests"
php artisan notify "All tests passed" -t "Tests"

# Force a specific protocol
php artisan notify "Hello" --protocol=osc777
php artisan notify "Hello" -p osc9

# Check terminal support
php artisan notify --info

# Full diagnostics with interactive tests
php artisan notify:diagnose
```

### Exit Code Mode

[](#exit-code-mode)

Pipe the exit status of any command to get automatic success/failure notifications:

```
# Basic usage - $? contains the exit code of the previous command
php artisan test; php artisan notify --exit-code=$?

# With npm/node commands
npm run build; php artisan notify -e $?

# Custom messages
php artisan migrate; php artisan notify -e $? --success-message="Migrations done" --failure-message="Migration failed"

# Custom titles
phpunit; php artisan notify -e $? --success-title="PHPUnit" --failure-title="PHPUnit"
```

Facade
------

[](#facade)

The `Notify` facade provides convenient access to all notification features:

```
use SoloTerm\Notify\Laravel\Facades\Notify;

// Basic notifications
Notify::send('Message', 'Title');
Notify::send('Message', 'Title', Notify::URGENCY_CRITICAL);

// Semantic methods with default titles from config
Notify::success('Task completed');     // Title: "Success"
Notify::error('Something went wrong'); // Title: "Error", critical urgency
Notify::warning('Check this out');     // Title: "Warning"
Notify::info('FYI');                   // Title: "Info", low urgency

// Other methods
Notify::sendOrBell('Message');         // Falls back to bell if unsupported
Notify::sendAny('Message');            // Uses OSC or external fallback
Notify::bell();                        // Just the bell character
```

Scheduler Integration
---------------------

[](#scheduler-integration)

Notify when scheduled tasks complete - perfect for long-running commands:

```
// In routes/console.php or app/Console/Kernel.php

// Notify after task completes
$schedule->command('backup:run')
    ->daily()
    ->thenNotify('Backup complete!');

// Notify with custom title
$schedule->command('reports:generate')
    ->hourly()
    ->thenNotify('Reports ready', 'Reports');

// Notify only on success
$schedule->command('sync:data')
    ->everyFiveMinutes()
    ->thenNotifySuccess('Sync completed');

// Notify only on failure
$schedule->command('payments:process')
    ->hourly()
    ->thenNotifyFailure('Payment processing failed!');

// Notify on both success and failure
$schedule->command('deploy:production')
    ->daily()
    ->withNotification();  // Uses command name for messages

// Custom messages for both outcomes
$schedule->command('cleanup:logs')
    ->weekly()
    ->withNotification(
        successMessage: 'Cleanup finished',
        failureMessage: 'Cleanup failed',
        title: 'Maintenance'
    );
```

Event Listener
--------------

[](#event-listener)

Automatically notify when Artisan commands complete:

```
// In config/notify.php
'events' => [
    'command_finished' => [
        'enabled' => true,  // or env('NOTIFY_ON_COMMAND_FINISHED', false)
        'success_title' => 'Command Completed',
        'failure_title' => 'Command Failed',
    ],
    'excluded_commands' => [
        'notify',
        'list',
        'help',
        // Add commands you don't want notifications for
    ],
],
```

Log Channel
-----------

[](#log-channel)

Send log messages as desktop notifications:

```
// In config/logging.php
'channels' => [
    // ... other channels ...

    'notify' => [
        'driver' => 'custom',
        'via' => \SoloTerm\Notify\Laravel\Logging\CreateNotifyLogger::class,
        'level' => 'warning',  // Only warning and above
        'title' => 'My App',
    ],
],
```

Then use it:

```
use Illuminate\Support\Facades\Log;

// Send to notify channel
Log::channel('notify')->error('Database connection lost!');
Log::channel('notify')->warning('High memory usage');

// Or add to your stack
'stack' => [
    'driver' => 'stack',
    'channels' => ['daily', 'notify'],
],
```

Log levels map to urgency:

- `emergency`, `alert`, `critical`, `error` → Critical urgency
- `warning`, `notice` → Normal urgency
- `info`, `debug` → Low urgency

> **Note:** This log channel is designed for CLI usage (Artisan commands, queue workers, scheduled tasks). In web requests, there's no terminal attached, so notifications are silently skipped. For web request logging, use a different channel in your stack.

Progress Bars
-------------

[](#progress-bars)

Display progress in the terminal tab/taskbar for long-running commands:

```
use SoloTerm\Notify\Laravel\Facades\Notify;

// Check if the terminal supports progress bars
if (Notify::supportsProgress()) {
    // Show progress (0-100)
    Notify::progress(25);
    Notify::progress(50);
    Notify::progress(100);

    // Clear when done
    Notify::progressClear();
}
```

### Progress States

[](#progress-states)

```
// Normal progress (blue/default)
Notify::progress(75);

// Error state (red)
Notify::progressError(100);

// Paused state (yellow)
Notify::progressPaused(50);

// Indeterminate/pulsing
Notify::progressIndeterminate();

// Hide/clear
Notify::progressClear();
```

### Terminal Support

[](#terminal-support)

Progress bars are supported in:

- **Windows Terminal** - Full support
- **Ghostty** - Full support (1.2+)
- **iTerm2** - Full support (3.6.6+)
- **ConEmu/Mintty** - Full support

Queue Worker Notifications
--------------------------

[](#queue-worker-notifications)

Get notified when queue workers start processing and when they stop:

```
// In AppServiceProvider or a dedicated provider
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Queue\Events\WorkerStopping;
use Illuminate\Support\Facades\Event;
use SoloTerm\Notify\Laravel\Facades\Notify;

public function boot(): void
{
    // Notify when queue starts processing (first job only)
    $notified = false;
    Event::listen(JobProcessing::class, function () use (&$notified) {
        if (!$notified) {
            Notify::info('Queue worker started processing', 'Queue');
            $notified = true;
        }
    });

    // Notify when queue worker stops
    Event::listen(WorkerStopping::class, function () {
        Notify::warning('Queue worker stopping', 'Queue');
    });
}
```

SendsNotifications Trait
------------------------

[](#sendsnotifications-trait)

Add notification capabilities to any Artisan command:

```
