Windows swoole-cli Monitor

Change the file to automatically restart the service.

Install

  1. install NodeJS.
  2. download swoole-cli-v4.x.x-cygwin64.zip and unzip.
  3. npm i -g windows-swoole-cli-monitor

Example

The directory where swoole-cli.exe is located should be placed in the system environment variable.

cd swoole-project
windows-swoole ./index.php -w ./app/**/*.php -w ./view/**/*.php

Edit swoole-project/index.php

<?php

$http = new Swoole\Http\Server('0.0.0.0', 9501);

$http->on('Request', function ($request, $response) {
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();

Command line options

--cli-path or -c: swoole-cli.exe path, default swool-cli.exe.

--watch-path or -w: watch file path, supports multiple.

GitHub

View Github