2bj/phanybar
Control AnyBar from PHP or the command line. Send color/status updates to a running AnyBar instance, optionally targeting a custom UDP port. Includes a simple CLI (phanybar green) and a small library API (send('green', 1738)).
1738).composer require 2bj/phanybar
require 'vendor/autoload.php';
use Bakyt\Console\Phanybar;
$phanybar = new Phanybar();
$phanybar->send('green'); // Turn AnyBar green (e.g., build passed)
Ideal for CI/CD feedback: turn green on success, red on failure.# In a deployment script
php artisan deploy && phanybar green || phanybar red
// In a job's `handle()`
$phanybar = new Phanybar();
$phanybar->send('blue'); // 'processing'
// PHPUnit bootstrap file
(new Phanybar)->send($result->failures() > 0 ? 'red' : 'green');
$phanybar->send('yellow', 1739); // Avoid conflicts if running multiple AnyBar instances
1738; if running multiple instances (e.g., AnyBar -p 1739), you must specify the port in send().send() is blocking UDP. For high-frequency updates, batch calls or debounce with a queue.class ModernPhanybar extends Phanybar {
public function send(string $color, int $port = 1738): void {
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_sendto($socket, $color, strlen($color), 0, '127.0.0.1', $port);
socket_close($socket);
}
}
netcat to verify messages reach AnyBar:
echo "red" | nc -u -w0 127.0.0.1 1738
How can I help you explore Laravel packages today?