nexphant/dev
Development-only file watcher with automatic process restarting for live reloading.
Install
bash
composer require nexphant/dev --devUsage
bash
php nexphant.dev.phpOr via composer:
bash
composer run devConfiguration
The dev reloading configuration is defined in a php script, typically nexphant.dev.php:
php
use Nexphant\Dev\Reload;
Reload::watch(['app/', 'config/', 'routes/'])
->ignore(['storage/', 'vendor/', '.git/'])
->ext(['php', 'env', 'json'])
->command('php app.php')
->delay(300) // debounce delay in ms
->gracefulTimeout(5.0) // shutdown timeout in seconds
->run();CLI Hot Reloading API
| Method | Return Type | Description |
|---|---|---|
watch(array $paths) | self | Paths to watch for modifications, creations, or deletions. |
ignore(array $paths) | self | Paths to exclude from file watching. |
ext(array $extensions) | self | Specific file extensions to monitor (e.g. ['php', 'json']). |
command(string $command) | self | Command to execute and reload. |
delay(int $ms) | self | Debounce time in milliseconds between changes and restart. |
gracefulTimeout(float $seconds) | self | Maximum time to wait for worker process to terminate after sending SIGTERM. |
root(string $root) | self | The base project path. |
run() | void | Starts the file watcher snapshot and runner loop. |
