PHP-Controllable Vulkan Rendering Extension

Maintainers

Package info

github.com/php-io-extensions/vulkan

Language:C

Type:php-ext

Ext name:ext-vulkan

pkg:composer/php-io-extensions/vulkan

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.7.1 2026-08-09 17:32 UTC

This package is auto-updated.

Last update: 2026-08-09 17:35:51 UTC


README

PHP Vulkan Built with Zephir Platform License: MIT

PHP extension for Vulkan — built with Zephir, installable via PHP PIE.

vulkan exposes instance/device/swapchain present helpers to PHP 8.2+ as namespaced classes under Vulkan\Vk\…. Static methods live on Vulkan\Vk\Vk; opaque handles are Zephir DTOs with a public fd (pointer as int). Windowing belongs to peer extensions (glfw); this package is draw/present bindings.

On macOS the loader typically needs MoltenVK (brew install molten-vk vulkan-loader vulkan-headers).

Requirements

Component Minimum version Notes
PHP 8.2 ZTS and NTS builds both supported.
Vulkan loader 1.x Discoverable via pkg-config vulkan.
OS Linux / macOS Darwin uses MoltenVK (portability enumeration). Windows not supported.
Compiler C11 toolchain gcc, clang, or Apple Clang.
php-dev / phpize matches PHP Required for any build path that is not PIE.

Demo additionally requires the glfw extension for the window + VkSurfaceKHR.

Installation

Via PHP PIE (recommended)

pie install php-io-extensions/vulkan

Platform installers

macOS (Homebrew):

bash install-macos.sh
# or Herd:
bash install-macos-herd.sh

Debian Trixie / Raspberry Pi OS:

bash install-debian-trixie.sh

Manual build with Zephir (maintainers)

export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
# Darwin + Homebrew MoltenVK (glfw dlopen of libvulkan):
export DYLD_LIBRARY_PATH="/opt/homebrew/lib:${DYLD_LIBRARY_PATH:-}"
export VK_ICD_FILENAMES="/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json"
bash scripts/prepare-ext.sh
cd ext && phpize && ./configure --enable-vulkan && make -j1
php -d extension=modules/vulkan.so --ri vulkan

Quick start

use Vulkan\Vk\Vk;

$instance = Vk::createInstance($glfwRequiredExtensions, 'my-app');
$devices = Vk::enumeratePhysicalDevices($instance);
// … create device/queue/swapchain, then:
Vk::presentFrame($swapchain, 0.1, 0.2, 0.3, 1.0);

Visual proof (Quit menu):

export DYLD_LIBRARY_PATH="/opt/homebrew/lib:${DYLD_LIBRARY_PATH:-}"
export VK_ICD_FILENAMES="/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json"
VULKAN_PROOF_SECONDS=3 php -d extension=./ext/modules/vulkan.so examples/proof_menu.php

Agent docs

Package knowledge lives in .okf/. See AGENTS.md.

License

MIT — see LICENSE.