Start plaintext HTTP/1.1
Run HTTP/1.1 without TLS on 127.0.0.1:9000 for local development or behind an HTTPS reverse proxy on the same host.
Install the package
Use PHP CLI 8.3 or a later 8.x release on a supported Unix system. Install the package in your application directory. Composer checks for the required pcntl, posix and sockets extensions.
apt · Debian / Ubuntu
sudo apt update
sudo apt install php-cli php-common composer curlapk · Alpine 3.24 (community)
apk add php85 php85-pcntl php85-posix php85-sockets composer curlpacman · Arch Linux
sudo pacman -Syu --needed php composer curl
php --iniEnable sockets in the CLI php.ini. For HTTP/2 and HTTP/3, also enable ffi.
dnf · Fedora
sudo dnf install php-cli php-process composer curlbrew · macOS
brew install php composer curlIn the test terminal, use Homebrew curl.
export PATH="$(brew --prefix curl)/bin:$PATH"php -v
composer require mini4work/webserver
composer check-platform-reqsStart the server
Save the example as m4w.json in the application root and start the bundled handler.
{
"listen": { "port": 9000 },
"protocols": { "http": "1.1" },
"tls": { "mode": "off" }
}php vendor/mini4work/webserver/examples/server.php m4w.jsonSend a request
In a second terminal, send a request to the loopback listener.
curl --http1.1 -i http://127.0.0.1:9000/helloThe response is HTTP 200 with a JSON body.
Start HTTP/1.1 with TLS