Building from Source
php-vio is a standard PHP extension built with phpize/autotools. All features are optional – enable only what you need.
Build Flags
| Flag | Feature | Dependency |
|---|---|---|
--enable-vio | Core extension | PHP development headers |
--with-glfw | Windowing & input through GLFW – optional where a native window layer is built (Windows, macOS, X11, Wayland) | GLFW 3.4 |
--with-x11 | Native X11 window layer (Linux; on by default when the headers are found) | Xlib, XRandR |
--with-wayland | Native Wayland window layer (Linux; on by default when the libraries are found) | wayland-client, wayland-cursor, xkbcommon, wayland-scanner, wayland-protocols |
--with-glslang | GLSL → SPIR-V compilation | glslang |
--with-spirv-cross | Shader reflection & transpilation | SPIRV-Cross |
--with-vulkan | Vulkan backend | Vulkan SDK |
--with-ffmpeg | Video recording & streaming | FFmpeg (libavcodec, libavformat, libavutil, libswscale) |
--with-metal | Metal backend (macOS only) | Metal + QuartzCore frameworks |
--with-harfbuzz | Text shaping: Arabic, Thai, ligatures, bidirectional and vertical text, on-demand glyph atlas, SDF fonts (VIO_HAS_SHAPING) | HarfBuzz |
--with-accesskit=DIR | Screen readers (vio_a11y_update()) | The unpacked accesskit-c release package |
--with-ffx | AMD FidelityFX FSR 3.1 native upscaler (Windows: on by default; elsewhere opt-in) | None at build time (vendored MIT headers); amd_fidelityfx_*.dll at run time |
DLSS
php-vio has no DLSS build option and contains no NVIDIA code – the DLSS SDK is under NVIDIA's licence. DLSS comes as a separately built plugin (vio_dlss.dll / libvio_dlss.so) that a game ships together with NVIDIA's nvngx_dlss.dll; php-vio loads it at run time through its upscaler plugin ABI.
Minimal Build
Just windowing and OpenGL:
phpize && ./configure --enable-vio --with-glfw && makeFull Build (macOS)
brew install glfw glslang spirv-cross vulkan-loader vulkan-headers ffmpeg harfbuzz
phpize && ./configure --enable-vio \
--with-glfw --with-glslang --with-spirv-cross \
--with-vulkan --with-ffmpeg --with-metal --with-harfbuzz && \
make -j$(sysctl -n hw.ncpu)Full Build (Linux)
sudo apt install php-dev libglfw3-dev glslang-dev libvulkan-dev \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
spirv-cross libspirv-cross-c-shared-dev libharfbuzz-dev libx11-dev libxrandr-dev \
libwayland-dev wayland-protocols libxkbcommon-dev
phpize && ./configure --enable-vio \
--with-glfw --with-glslang --with-spirv-cross \
--with-vulkan --with-ffmpeg --with-harfbuzz && \
make -j$(nproc)Windows
See the Getting Started guide for Windows-specific instructions.
Conditional Compilation
Missing dependencies don't cause build errors. Each feature is wrapped in #ifdef HAVE_* guards:
#ifdef HAVE_GLFW // Windowing & input
#ifdef HAVE_VULKAN // Vulkan backend
#ifdef HAVE_METAL // Metal backend
#ifdef HAVE_FFMPEG // Recording & streaming
#ifdef HAVE_GLSLANG // Shader compilation
#ifdef HAVE_SPIRV_CROSS // Shader reflectionFunctions for unavailable features return false at runtime.
Vendored Libraries
These are included in the repository and compiled automatically:
| Library | Location | Purpose |
|---|---|---|
| GLAD | vendor/glad/ | OpenGL function loader |
| stb_image | vendor/stb/ | PNG/JPG/BMP loading |
| stb_truetype | vendor/stb/ | TTF font rendering |
| stb_image_write | vendor/stb/ | PNG saving |
| VMA | vendor/vma/ | Vulkan Memory Allocator |
| miniaudio | vendor/miniaudio/ | Audio engine |
| ffx-api | vendor/ffx-api/ | FidelityFX API headers (MIT, SDK v1.1.4) |
Build System Files
| File | Purpose |
|---|---|
config.m4 | Autotools configuration (phpize/configure) |
Makefile.frag | Extra rules: VMA (C++14), Metal (ObjC+ARC) |
CMakeLists.txt | Alternative CMake build |
Installing
sudo make install
# Or copy manually
cp modules/vio.so $(php-config --extension-dir)/Release Binaries
Pre-built release archives (ZIP) contain the binary named vio.so (or vio.dll on Windows) for Position Independent Executable (PIE) compatibility.
Add to php.ini:
extension=vioLaravel Herd
To use with Laravel Herd's PHP 8.4:
# Build against Herd's PHP
/usr/local/Cellar/php@8.4/8.4.19/bin/phpize && \
./configure --enable-vio --with-glfw \
--with-php-config=/usr/local/Cellar/php@8.4/8.4.19/bin/php-config && \
make
# Copy to Herd's extension directory
cp modules/vio.so ~/Library/Application\ Support/Herd/config/php/extensions/Enable in Herd's php.ini:
~/Library/Application Support/Herd/config/php/84/php.ini