Skip to content

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 ​

FlagFeatureDependency
--enable-vioCore extensionPHP development headers
--with-glfwWindowing & input through GLFW – optional where a native window layer is built (Windows, macOS, X11, Wayland)GLFW 3.4
--with-x11Native X11 window layer (Linux; on by default when the headers are found)Xlib, XRandR
--with-waylandNative Wayland window layer (Linux; on by default when the libraries are found)wayland-client, wayland-cursor, xkbcommon, wayland-scanner, wayland-protocols
--with-glslangGLSL → SPIR-V compilationglslang
--with-spirv-crossShader reflection & transpilationSPIRV-Cross
--with-vulkanVulkan backendVulkan SDK
--with-ffmpegVideo recording & streamingFFmpeg (libavcodec, libavformat, libavutil, libswscale)
--with-metalMetal backend (macOS only)Metal + QuartzCore frameworks
--with-harfbuzzText shaping: Arabic, Thai, ligatures, bidirectional and vertical text, on-demand glyph atlas, SDF fonts (VIO_HAS_SHAPING)HarfBuzz
--with-accesskit=DIRScreen readers (vio_a11y_update())The unpacked accesskit-c release package
--with-ffxAMD 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:

bash
phpize && ./configure --enable-vio --with-glfw && make

Full Build (macOS) ​

bash
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) ​

bash
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:

c
#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 reflection

Functions for unavailable features return false at runtime.

Vendored Libraries ​

These are included in the repository and compiled automatically:

LibraryLocationPurpose
GLADvendor/glad/OpenGL function loader
stb_imagevendor/stb/PNG/JPG/BMP loading
stb_truetypevendor/stb/TTF font rendering
stb_image_writevendor/stb/PNG saving
VMAvendor/vma/Vulkan Memory Allocator
miniaudiovendor/miniaudio/Audio engine
ffx-apivendor/ffx-api/FidelityFX API headers (MIT, SDK v1.1.4)

Build System Files ​

FilePurpose
config.m4Autotools configuration (phpize/configure)
Makefile.fragExtra rules: VMA (C++14), Metal (ObjC+ARC)
CMakeLists.txtAlternative CMake build

Installing ​

bash
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:

ini
extension=vio

Laravel Herd ​

To use with Laravel Herd's PHP 8.4:

bash
# 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

Released under the MIT License.