Auto Restart Service

Swoft 2.0 removes the automatic restart feature from the built-in component, which is provided by the new standalone tool SWOFT-CLI.

It is important to note that 2.0 of the inside is to restart the entire service instead of just reload the work process like 1.0

Command: serve:run (you can also use aliases directly run )

View available options

php swoftcli.phar run -h

# 如果已放到了全局PATH里,可以直接这样使用
swoftcli run -h

hot-restart-help

List of options

  • -b, --bin-fileSpecifies the entry file for the Swoft app, which defaults tobin/swoft
  • --intervalThe interval between monitoring files, checked once by default 3 seconds
  • --php-binSpecify your PHP executable file, which will automatically look for PHP from global path by default
  • -c, --start-cmdSpecify the server startup command, which defaults to http:start (start HTTP server)
  • -w, --watchSpecifies the directory to monitor, as opposed to the app directory. app,configFile changes in the default monitoring

Parameter list

targetPathThere is only one parameter that specifies the directory of the Swoft app to run, and the default view is that the current directory

Working with examples

swoftcli run -c ws:start -b bin/swoft /path/to/php/swoft

After the run is successful, you can see the following information:

run-hot-restart

When a file changes, SWOFT-CLI automatically restarts the app

/docs/2.x/en/tool/swoftcli/hot-restart.html
progress-bar