PHPackages                             microscrap/vulkan - 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. [Framework](/categories/framework)
4. /
5. microscrap/vulkan

ActiveLibrary[Framework](/categories/framework)

microscrap/vulkan
=================

Vulkan Bindings for The PHP Vulkan Extension

0.7.0(yesterday)001MITPHPPHP ^8.3CI failing

Since Aug 9Pushed todayCompare

[ Source](https://github.com/microscrap/vulkan)[ Packagist](https://packagist.org/packages/microscrap/vulkan)[ Docs](https://dosr.projectsaturnstudios.com)[ RSS](/packages/microscrap-vulkan/feed)WikiDiscussions 0.7.x Synced today

READMEChangelogDependencies (2)Versions (3)Used By (1)

microscrap/vulkan — Vulkan bindings for PHP
===========================================

[](#microscrapvulkan--vulkan-bindings-for-php)

[![Docs](https://camo.githubusercontent.com/f6af43646187c0a22feff71385ac7408b8ba926c0ca87b21722fa0e15e6bd0a9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d302e372e782d3041374541343f6c6f676f3d72656164746865646f6373266c6f676f436f6c6f723d7768697465)](https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/vulkan/0.7.x/overview)[![Latest Version on Packagist](https://camo.githubusercontent.com/4a6d9b3449e0bb391f99345ba08d7e27d86f1c731fdec0a35f7504e409114045/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6963726f73637261702f76756c6b616e2e7376673f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/microscrap/vulkan)[![Tests](https://github.com/microscrap/vulkan/actions/workflows/tests.yml/badge.svg)](https://github.com/microscrap/vulkan/actions/workflows/tests.yml)[![PHP Version Require](https://camo.githubusercontent.com/86a0e01440e0cb9f76950c580c5141f86a8fc26c0062021701f63a76fa022681/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6963726f73637261702f76756c6b616e2e737667)](https://packagist.org/packages/microscrap/vulkan)[![ext-vulkan](https://camo.githubusercontent.com/84271f0acb78e02ba1fccbfbf52f1c67a6c2906a746cdc528fe91d8d475cfbc8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6578742d2d76756c6b616e2d253545302e372e302d627269676874677265656e)](https://github.com/php-io-extensions/vulkan)[![Total Downloads](https://camo.githubusercontent.com/cecd18bbf81533d14e8405d1185c7e663a79e6a93990ce77e9f0ec9f7ff0ff5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6963726f73637261702f76756c6b616e2e737667)](https://packagist.org/packages/microscrap/vulkan)[![License](https://camo.githubusercontent.com/8cce73bec7379a03a5b67fa0916ab167124ef5d736ad78add887d48093431945/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6963726f73637261702f76756c6b616e2e737667)](LICENSE)

**Docs:** [ScrapyardIO ecosystem — microscrap/vulkan `0.7.x`](https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/vulkan/0.7.x/overview)

PHP library that wraps the [**vulkan**](https://github.com/php-io-extensions/vulkan) extension with global helpers, enums, and data objects. Every helper delegates to `Microscrap\Bindings\Vulkan\Vk`.

The package covers the entire extension surface (14 methods on `Vulkan\Vk\Vk`): instance/device lifecycle, queue selection, surface wrap/destroy, swapchain create/resize/destroy, and present-frame clear + optional menu/inner/accent rects. Window surfaces are created via **microscrap/glfw** (`CLIENT_API = NO_API` + `glfwCreateWindowSurface`).

Highlights
----------

[](#highlights)

- Two calling styles — C-ish `vk*` helpers (`vkCreateInstance(...)`) or static wrapper (`Vk::createInstance(...)`)
- Opaque Vulkan handles wrapped in typed `final readonly` data objects (`VkInstance`, `VkPhysicalDevice`, `VkDevice`, `VkQueue`, `VkSurface`, `VkSwapchain`)
- Enum layer for common `VkResult` / `VkPhysicalDeviceType` values (cases FULLY UPPERCASE; no class constants)
- C-style error handling: no exceptions in `src/`; details via `vkLastError()`
- Coverage drift guard: a Pest test reflects the extension and fails if any extension method lacks a wrapper method or helper function

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

[](#requirements)

- PHP 8.3+
- **ext-vulkan** ^0.7.0 — install from [php-io-extensions/vulkan](https://github.com/php-io-extensions/vulkan)
- **microscrap/glfw** ^0.5.0 — for `vkCreateWindowSurface` / GLFW windowing peer
- **ext-glfw** ^0.5.0 — required by microscrap/glfw

Installation
------------

[](#installation)

Confirm **ext-vulkan** (and **ext-glfw** if you need surfaces) are loaded:

```
php -m | grep -E 'vulkan|glfw'
```

```
composer require microscrap/vulkan
```

Composer autoloads `src/Helpers/vk.php`, registering the global `vk*` functions when the package is installed. Helpers are only defined if the name is not already taken (`function_exists` guard).

The two calling styles
----------------------

[](#the-two-calling-styles)

**C-ish** — global functions with `vk*` names:

```
use Microscrap\Bindings\GLFW\Enums\ClientApi;
use Microscrap\Bindings\GLFW\Enums\TrueFalse;
use Microscrap\Bindings\GLFW\Enums\WindowHint;

glfwInit();
glfwWindowHint(WindowHint::GLFW_CLIENT_API, ClientApi::GLFW_NO_API->value);
$window = glfwCreateWindow(400, 600, 'vulkan');

$extensions = glfwGetRequiredInstanceExtensions();
$instance = vkCreateInstance($extensions, 'demo');
$created = vkCreateWindowSurface($instance, $window);
$surface = $created['surface'];

// ... enumerate devices, create device/queue/swapchain, presentFrame ...

vkDestroySurface($instance, $surface);
vkDestroyInstance($instance);
glfwDestroyWindow($window);
glfwTerminate();
```

**OO-ish** — static wrapper class, same behavior:

```
use Microscrap\Bindings\Vulkan\Vk;

$instance = Vk::createInstance([], 'demo');
Vk::destroyInstance($instance);
```

Helpers never touch the extension directly; they delegate one-to-one to `Vk`, which is the only layer calling `Vulkan\Vk\Vk`. Both styles accept and return the same data objects (or the raw extension objects).

### Name transforms

[](#name-transforms)

- Wrapper methods match the extension camelCase names: `createInstance` → `Vk::createInstance()`.
- Helpers prefix with `vk` and capitalize: `createInstance` → `vkCreateInstance()`.
- Convenience bridge (not on the extension): `Vk::createWindowSurface()` / `vkCreateWindowSurface()` wraps glfw + `wrapSurface`.

Wrapper surface
---------------

[](#wrapper-surface)

MethodNotes`lastError`Last Vulkan/loader error string`createInstance` / `destroyInstance`Instance lifecycle`enumeratePhysicalDevices`Physical devices with name/type/ids`findGraphicsPresentQueue`Queue family for graphics + present`createDevice` / `destroyDevice`Logical device`getDeviceQueue`Queue handle`wrapSurface` / `destroySurface`SurfaceKHR from fd`createSwapchain` / `destroySwapchain` / `resizeSwapchain`Presentable swapchain`presentFrame`Clear + optional UI rectsData objects live under `Microscrap\Bindings\Vulkan\DataObjects`. Enums live under `Microscrap\Bindings\Vulkan\Enums`.

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10563160?v=4)[Angel Gonzalez](/maintainers/projectsaturnstudios)[@projectsaturnstudios](https://github.com/projectsaturnstudios)

---

Top Contributors

[![projectsaturnstudios](https://avatars.githubusercontent.com/u/10563160?v=4)](https://github.com/projectsaturnstudios "projectsaturnstudios (3 commits)")

---

Tags

frameworkVulkanscrapyard-io

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/microscrap-vulkan/health.svg)

```
[![Health](https://phpackages.com/badges/microscrap-vulkan/health.svg)](https://phpackages.com/packages/microscrap-vulkan)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
