PHPackages                             php-io-extensions/metal - 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. php-io-extensions/metal

ActivePhp-ext

php-io-extensions/metal
=======================

PHP-Controllable Darwin Metal + AppKit window, menu, and drawing extension

0.7.x-dev(today)00MITCPHP &gt;=8.2

Since Aug 9Pushed todayCompare

[ Source](https://github.com/php-io-extensions/metal)[ Packagist](https://packagist.org/packages/php-io-extensions/metal)[ RSS](/packages/php-io-extensions-metal/feed)WikiDiscussions 0.7.x Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

php-metal
=========

[](#php-metal)

[![PHP](https://camo.githubusercontent.com/c43902a50e55ff766fc179e27d9b9a292ef8fcadbdd4d855bb077a334e2f9b46/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135253230382e322d3737376262343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net)[![Metal](https://camo.githubusercontent.com/f131abed6a890937c4e65c72f50d787ecf15b38c7c1b5c02aafdbc615bdaf80e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6574616c2d6d61634f532532306f6e6c792d626c61636b)](https://developer.apple.com/metal/)[![Built with Zephir](https://camo.githubusercontent.com/8e72a9e9874ec036e66f84af12bd028857d1f200674b7acaa9eb97271a123f7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d5a65706869722d666636613030)](https://zephir-lang.com/)[![Platform](https://camo.githubusercontent.com/4087e046d7688cfe7d5ad93be3ecdf9ddcb25eb0ccc8d2640940a0f61b62b6be/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6d61634f532d6c6967687467726579)](#requirements)[![License: MIT](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](#license)

> PHP extension for Apple Metal + AppKit — built with [Zephir](https://zephir-lang.com/), installable via [PHP PIE](https://github.com/php/pie).

`metal` is a **standalone macOS-only** binding: open an `NSWindow`, install a macOS menu bar, draw through a `CAMetalLayer` with Metal, and create offscreen `MTLTexture` targets (0.7.1+) for headless engines/UIs. It has no knowledge of other windowing libraries.

PHP API is namespaced under `Metal\MTL\…` as static classes. Opaque native handles are `int` values.

---

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

[](#requirements)

ComponentMinimum versionNotesPHP8.2ZTS and NTSOSmacOSarm64 + x86\_64 (PIE `os-families: darwin`)FrameworkssystemMetal, AppKit, QuartzCore, FoundationCompilerApple ClangObjective-C ARC`php-dev` / `phpize`matches PHPRequired for non-PIE builds---

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

[](#installation)

### Via PHP PIE (recommended)

[](#via-php-pie-recommended)

```
pie install php-io-extensions/metal
```

macOS only — configure fails on other platforms.

### Platform installer

[](#platform-installer)

```
bash install-macos.sh
```

Laravel Herd:

```
bash install-macos-herd.sh
```

### Manual build (maintainers)

[](#manual-build-maintainers)

```
bash scripts/prepare-ext.sh
cd ext && phpize && ./configure --enable-metal && make -j1
php -n -d extension=modules/metal.so --ri metal
```

`scripts/prepare-ext.sh` regenerates Zephir C, syncs `src/` into `ext/src/`, patches `config.m4`, installs `Makefile.frag` for `.m` sources, and strips phpize junk so the committed `ext/` tree stays PIE-ready.

> Use `make -j1` (or the installer). Parallel make is fine for `.c` objects; the ObjC fragment is conservative.

---

Quick start
-----------

[](#quick-start)

```
use Metal\MTL\App;
use Metal\MTL\Device;
use Metal\MTL\Menu;
use Metal\MTL\Window;

App::init();
Menu::installDefault('My App');
Menu::addItem('Demo', 'Quit Demo', 'q', 'quit');

$window = Window::create('Metal', 800, 600);
$device = Device::createSystemDefault();
Window::attachDevice($window, $device);

while (!Window::shouldClose($window) && !App::shouldQuit()) {
    App::poll();
    if (Menu::pollAction() === 'quit') {
        break;
    }
    Window::clear($window, 30, 30, 40, 255);
    usleep(16_000);
}

Window::destroy($window);
Device::release($device);
```

Demo:

```
php -d extension=./ext/modules/metal.so examples/proof_window.php
# optional smoke: METAL_DEMO_MAX_FRAMES=90 php -d extension=./ext/modules/metal.so examples/proof_window.php
```

---

API surface (0.7)
-----------------

[](#api-surface-07)

ClassRole`Metal\MTL\App``NSApplication` init / poll / quit`Metal\MTL\Window``NSWindow` + `CAMetalLayer` clear/present`Metal\MTL\Menu`Menu bar + custom items / Quit`Metal\MTL\Device``MTLDevice` / command queue handles---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity31

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

Unknown

Total

1

Last Release

0d 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)")

### Embed Badge

![Health badge](/badges/php-io-extensions-metal/health.svg)

```
[![Health](https://phpackages.com/badges/php-io-extensions-metal/health.svg)](https://phpackages.com/packages/php-io-extensions-metal)
```

PHPackages © 2026

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