First run

Start the server

From the directory containing server.json, start the bundled handler with the profile from Basic configuration.

Shell
php vendor/mini4work/webserver/examples/server.php server.json

With the two-worker profile, the server.listening log entry shows "workers":2 and "connections_per_worker":16. Restart the server after editing the file.

Run with the defaults

Without a profile, the server listens on 127.0.0.1:8080. Use port 8080 for the request below.

Shell
php vendor/mini4work/webserver/examples/server.php

Send a request

In a second terminal, send a request to the loopback listener.

Shell
curl -i http://127.0.0.1:9000/hello

Expect a 200 response with JSON containing "method": "GET", "path": "/hello" and the worker_pid that served it. This JSON comes from the bundled inspection handler. Press Ctrl+C in the server terminal to begin shutdown.

Run your application

Replace the inspection handler with your own PHP handler. The same handler works on all three protocols. When sizing the deployment, configure worker capacity and rotation and apply endpoint limits to expensive routes.