Start HTTP/3
Install a QUIC backend, start a local UDP listener and confirm HTTP/3 with curl.
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 curlsudo apt install build-essential pkg-config libngtcp2-dev \
libngtcp2-crypto-gnutls-dev libnghttp3-dev libgnutls28-devapk · Alpine 3.24 (community)
apk add php85 php85-pcntl php85-posix php85-sockets composer curlapk add php85-ffi build-base pkgconf ngtcp2-dev nghttp3-dev gnutls-devpacman · 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.
sudo pacman -S --needed base-devel libngtcp2 libnghttp3 gnutlsdnf · Fedora
sudo dnf install php-cli php-process composer curlsudo dnf install php-ffi gcc make pkgconf-pkg-config ngtcp2-devel \
ngtcp2-crypto-gnutls-devel libnghttp3-devel gnutls-develbrew · macOS
brew install php composer curlbrew install cloudflare-quicheIn the test terminal, use Homebrew curl.
export PATH="$(brew --prefix curl)/bin:$PATH"php -v
composer require mini4work/webserver
composer check-platform-reqsphp --ri opensslphp --ri ffi
curl -VOn Linux, build the adapter with ngtcp2 1.22+ and nghttp3 1.14+. If your repositories lack compatible packages, follow the platform-specific build instructions. On macOS, the Homebrew quiche library is ready to use.
if [ "$(uname -s)" = Linux ]; then
make -C vendor/mini4work/webserver/native/ngtcp2
fiStart the server
Save this as m4w.json in the application root. It creates development certificates in var/tls. The client will trust the public CA explicitly for its request.
{
"listen": { "port": 9000 },
"protocols": {
"http": "3"
},
"tls": {
"mode": "local",
"storage": "var/tls",
"local": {
"trust_ca": "off"
}
}
}php -d ffi.enable=true vendor/mini4work/webserver/examples/server.php m4w.jsonSend a request
Run curl -V on the client. It must list HTTP3. Substitute the public CA path from tls.trust.root in the startup log.
curl · HTTP/3CA=/path/from/tls.trust.root
curl --http3-only --cacert "$CA" -sS -o /dev/null \
-w 'HTTP/%{http_version} %{http_code}\n' https://127.0.0.1:9000/HTTP/3 200