PHPackages                             phpolygon/php-vio - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. phpolygon/php-vio

ActivePhp-ext[Templating &amp; Views](/categories/templating)

phpolygon/php-vio
=================

PHP extension for GPU rendering (OpenGL, Vulkan, Metal), audio, video recording, streaming, and input

1.17.0(2w ago)125MITCPHP &gt;=8.4CI passing

Since Apr 11Pushed 6d agoCompare

[ Source](https://github.com/phpolygon/php-vio)[ Packagist](https://packagist.org/packages/phpolygon/php-vio)[ Docs](https://github.com/phpolygon/php-vio)[ RSS](/packages/phpolygon-php-vio/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)DependenciesVersions (62)Used By (0)

php-vio
=======

[](#php-vio)

A PHP extension that brings GPU rendering, audio, video recording, streaming, and input handling to PHP. Foundation layer for the [PHPolygon](https://github.com/phpolygon) game engine.

Features
--------

[](#features)

- **Multi-Backend GPU Rendering** — OpenGL 4.1, Vulkan (MoltenVK), Metal
- **2D Batch Renderer** — Rects, circles, lines, sprites, text (z-sorted, up to 4096 items)
- **3D Pipeline** — Meshes, shaders, pipelines, textures, uniform/storage buffers
- **Shader Toolchain** — GLSL to SPIR-V compilation, reflection, cross-compilation
- **Audio** — Playback via miniaudio (MP3, WAV, FLAC)
- **Video Recording** — H.264 encoding via FFmpeg (with VideoToolbox HW acceleration)
- **Network Streaming** — RTMP and SRT via FFmpeg
- **Input** — Keyboard, mouse, and gamepad support via GLFW
- **Headless Mode** — Offscreen rendering for tests and visual regression testing
- **Plugin System** — Extensible output/input/filter plugins
- **Cross-Platform** — macOS, Linux, Windows

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4

All native libraries are optional — the extension compiles and runs without them, features are simply unavailable at runtime:

LibraryFeatureBuild Flag[GLFW](https://www.glfw.org/) 3.4Windowing, input, gamepad`--with-glfw`[glslang](https://github.com/KhronosGroup/glslang)GLSL to SPIR-V compilation`--with-glslang`[SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross)Shader reflection &amp; transpilation`--with-spirv-cross`[Vulkan SDK](https://vulkan.lunarg.com/)Vulkan backend`--with-vulkan`[FFmpeg](https://ffmpeg.org/)Video recording &amp; streaming`--with-ffmpeg`Metal (macOS framework)Metal backend`--with-metal`Installation
------------

[](#installation)

### Via PIE (PHP Installer for Extensions)

[](#via-pie-php-installer-for-extensions)

```
pie install phpolygon/php-vio
```

### Pre-built Binaries

[](#pre-built-binaries)

Download platform-specific binaries from the [Releases](https://github.com/phpolygon/php-vio/releases) page. Available for:

- Linux x86\_64 / ARM64
- macOS x86\_64 (Intel) / ARM64 (Apple Silicon)
- Windows x64

### From Source (macOS)

[](#from-source-macos)

```
brew install glfw glslang spirv-cross ffmpeg

phpize
./configure --enable-vio --with-glfw --with-glslang --with-spirv-cross \
  --with-vulkan --with-ffmpeg --with-metal
make -j$(sysctl -n hw.ncpu)
sudo make install
```

### From Source (Linux)

[](#from-source-linux)

```
# Ubuntu/Debian
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

phpize
./configure --enable-vio --with-glfw --with-glslang --with-spirv-cross \
  --with-vulkan --with-ffmpeg
make -j$(nproc)
sudo make install
```

### Windows

[](#windows)

On Windows, no build toolchain is needed — PHP extensions are distributed as pre-compiled DLLs. Download the matching DLL from the [Releases](https://github.com/phpolygon/php-vio/releases) page (match your PHP version and thread-safety mode), then:

1. Copy `php_vio.dll` into your PHP `ext\` directory
2. Add `extension=vio` to your `php.ini`
3. Restart PHP / your web server

All backends use conditional compilation (`#ifdef HAVE_*`), so builds without certain dependencies compile fine — those features are simply unavailable at runtime.

Quick Start
-----------

[](#quick-start)

```
