Star RestPHP
Already starred? Check a public GitHub username below. This is not a GitHub login; only the username is remembered on this browser.
Appearance
Already starred? Check a public GitHub username below. This is not a GitHub login; only the username is remembered on this browser.
Welcome to RestPHP, the persistent application server and runtime for PHP powered by Rust.
RestPHP targets Linux (x86_64, arm64), macOS, and native Windows x64 (MSVC):
libphp-embed / php-dev)Use a linkable PHP embed library matching the headers and CPU architecture. Homebrew's Apache httpd/modules/libphp.so is a Mach-O bundle, not an embed dylib, and cannot be linked into RestPHP. A PHP CLI installation alone is not sufficient.
Windows links to php8.dll using the matching NTS development pack instead of libphp-embed. Follow the Windows native guide for the PowerShell setup script, build tools, and runtime DLL requirements.
curl -fsSL https://restphp.dev/install.sh | bashVerify your installation:
restphp --version
# Output: restphp 0.3.0Ensure you have php-dev and build essentials installed:
# Ubuntu / Debian
sudo apt-get install -y build-essential libphp-embed php-dev pkg-config clang
# Clone and compile
git clone https://github.com/arsyadal/restphp.git
cd restphp
cargo build --release
# Install binary to /usr/local/bin
sudo cp target/release/restphp /usr/local/bin/When multiple PHP versions are installed, set PHP_CONFIG, PHP_EMBED_LIB_NAME, and PHP_EMBED_LIB_DIR before building so the headers and libphp match:
PHP_CONFIG=/usr/bin/php-config8.3 \
PHP_EMBED_LIB_NAME=php8.3 \
PHP_EMBED_LIB_DIR=/usr/lib \
cargo build --release# Just run restphp — auto-detects Laravel, public/index.php, or index.php!
restphp
# Run any script directly on a custom port
restphp app.php -p 3000
# Evaluate inline PHP directly from terminal
restphp -e 'echo "Hello from RestPHP!\n";'Serve a conventional Laravel application through public/index.php, or install the Laravel Octane adapter for a boot-once application with Octane request sandboxes. Both modes use one NTS PHP worker per process; scale through supervised processes.