Download the PHP package soloterm/notify without Composer
On this page you can find all versions of the php package soloterm/notify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download soloterm/notify
More information about soloterm/notify
Files in soloterm/notify
Package notify
Short Description A PHP package to send desktop notifications via OSC escape sequences in terminal applications.
License MIT
Informations about the package notify
Notify
A PHP library for sending desktop notifications via OSC escape sequences in terminal applications.
This library was built to support Solo, your all-in-one Laravel command to tame local development.
| OSC Notifications (Ghostty) | OSC Notifications (iTerm2) |
| macOS Fallback | Fireworks (iTerm2) |
| Progress Bars (Ghostty) | Progress Bars (iTerm2) |
Why Use This Library?
Building CLI applications often requires notifying users when long-running tasks complete:
- Build finished
- Tests passed (or failed)
- Queue job completed
- Migration finished
Instead of relying on external tools like notify-send or osascript, this library uses OSC (Operating System Command) escape sequences that modern terminal emulators interpret directly. No dependencies, no shell commands, just pure PHP.
When OSC isn't supported, the library automatically falls back to system notification tools (notify-send on Linux, osascript on macOS, PowerShell on Windows).
Installation
Usage
Real-World Examples
Terminal Compatibility
| Terminal | Support | Protocol | Notes |
|---|---|---|---|
| iTerm2 | ✅ | OSC 9 | macOS |
| Kitty | ✅ | OSC 99 | Cross-platform, full-featured |
| WezTerm | ✅ | OSC 777 | Cross-platform |
| Ghostty | ✅ | OSC 777 | Cross-platform |
| Foot | ✅ | OSC 777 | Wayland |
| tmux | ✅ | Passthrough | Requires allow-passthrough on |
| GNU Screen | ✅ | Passthrough | Automatic wrapping |
| Alacritty | ⚠️ | Fallback | Uses system notifications |
| Terminal.app | ⚠️ | Fallback | Uses system notifications |
| VS Code | ⚠️ | Fallback | Uses system notifications |
| Windows Terminal | ⚠️ | Fallback | Uses system notifications |
tmux Configuration
For notifications to work inside tmux, add this to your ~/.tmux.conf:
Then reload your tmux configuration:
OSC Protocols
This library supports three notification protocols:
OSC 9 (iTerm2)
Simple message-only notifications. Widely supported.
OSC 777 (rxvt-unicode)
Supports separate title and body. Used by WezTerm, Ghostty, and VTE-based terminals.
OSC 99 (Kitty)
The most feature-rich protocol with support for urgency levels, notification IDs, and more.
Advanced Usage
Urgency Levels (Kitty/OSC 99 only)
Notification IDs (Kitty/OSC 99 only)
Update or dismiss existing notifications using IDs - perfect for progress indicators:
External Fallback
When OSC notifications aren't supported, the library can fall back to system tools:
- Linux:
notify-send(libnotify) - macOS:
osascript(AppleScript) - Windows: PowerShell toast notifications
Bell Fallback
Check Capabilities
Force a Specific Protocol
Check Multiplexer Status
Reset State
Progress Bars (OSC 9;4)
Display progress in your terminal's tab or taskbar:
Supported terminals: Windows Terminal, Ghostty 1.2+, iTerm2 3.6.6+, ConEmu, Mintty
Hyperlinks (OSC 8)
Create clickable links in terminal output:
Request Attention (iTerm2 only)
How It Works
-
Terminal Detection: The library checks environment variables like
KITTY_WINDOW_ID,ITERM_SESSION_ID,WEZTERM_PANE, andTERM_PROGRAMto identify the terminal. -
Protocol Selection: Based on the detected terminal, the optimal OSC protocol is selected.
-
Sequence Building: The notification message is sanitized and formatted according to the protocol.
-
Multiplexer Passthrough: If running inside tmux or GNU Screen, the sequence is wrapped in a DCS (Device Control String) passthrough.
-
Output: The escape sequence is written directly to STDOUT, which the terminal interprets and displays as a desktop notification.
- Fallback: If OSC isn't supported, the library automatically tries system notification tools.
Requirements
- PHP 8.1 or higher
- A supported terminal emulator (or system notification tools for fallback)
- For tmux:
allow-passthrough onin your config
Testing
Contributing
Contributions are welcome! Please feel free to submit a pull request.
License
The MIT License (MIT).
Support
This is free! If you want to support me:
- Check out my courses:
- Help spread the word about things I make
Credits
Solo was developed by Aaron Francis. If you like it, please let me know!
- Twitter: https://twitter.com/aarondfrancis
- Website: https://aaronfrancis.com
- YouTube: https://youtube.com/@aarondfrancis
- GitHub: https://github.com/aarondfrancis/solo
Related Projects
- Solo - All-in-one Laravel command for local development
- Screen - Pure PHP terminal renderer
- Dumps - Laravel command to intercept dumps
- Grapheme - Unicode grapheme width calculator
- Notify Laravel - Laravel integration for soloterm/notify
- TNotify - Standalone, cross-platform CLI for desktop notifications
- VTail - Vendor-aware tail for Laravel logs