Dev Reload
Automatic process restart on file change.
Setup
nexphant.dev.php:
php
use Nexphant\Dev\Reload;
Reload::create()
->watch(['app/', 'config/', 'routes/'])
->ignore(['storage/', 'vendor/'])
->run('php app.php');Start
bash
composer run devOutput:
[nexphant] dev reload started
[nexphant] watching: app/, config/, routes/
[nexphant] running: php app.phpEdit a File
Open app/Controllers/HomeController.php and save a change.
Output:
[nexphant] change detected: app/Controllers/HomeController.php
[nexphant] stopping process...
[nexphant] restarting: php app.php
[nexphant] running: php app.phpRestart Output
Full restart sequence:
- File change detected
SIGTERMsent to process- Process stops (graceful)
- New process starts
- Ready to accept requests
Crash Handling
If the process exits with an error:
[nexphant] process exited with code 255
[nexphant] stderr: PHP Fatal error: ...
[nexphant] waiting 1s before restart...
[nexphant] restarting: php app.phpNotes
- Dev reload polls every 500ms by default
- Not for production use
- Use
composer run start(php app.php) for production
