PAM Desktop
PAM Desktop lets you write desktop applications in PHP. You describe the interface with components, reactive state and stylesheets; a small Rust host lays the tree out and drives the real views of the platform: GTK 4 on Linux, AppKit on macOS and Win32 with Direct2D on Windows. There is no Electron, no Node.js and no web view in the rendering path.
<?php
declare(strict_types=1);
use Pam\Desktop\App;use Pam\Desktop\Attributes\State;use Pam\Desktop\Component;use Pam\Desktop\Style;use Pam\Desktop\UI\Button;use Pam\Desktop\UI\Column;use Pam\Desktop\UI\Text;
require __DIR__.'/vendor/autoload.php';
final class Counter extends Component{ #[State] public int $count = 0;
public function render(): Column { return Column::make( Text::make("Count: {$this->count}")->style(new Style(fontSize: 18)), Button::make('Increment')->onPress(function (): void { $this->count++; }), )->style(new Style(padding: 24, gap: 16)); }}
App::run(new Counter());Assigning to a #[State] property schedules a render. PHP computes what changed and the host receives a patch with the one text that differs. Animations, scrolling, text editing, gestures and media playback run in the host and never wait for PHP.
Why PAM Desktop
Section titled “Why PAM Desktop”- One language. Components, state, application logic, persistence and tests are PHP 8.5. Templates are
.pam.phpfiles with a familiar tag syntax and scoped CSS. - Native views. Text is shaped by the platform, inputs are native text fields, menus are the system’s menus, and accessibility goes through AT-SPI, NSAccessibility and UI Automation.
- Idle costs nothing. PHP sleeps in a blocking read between events, the frame clock stops when nothing animates, and pool threads exit after 30 seconds without work. On the reference Linux measurements an idle window uses 0.2% of one core and about 75 MB across both processes.
- Self-contained bundles.
pam-desktop buildships the host, the application and a PHP runtime, so the machine the application runs on needs neither PHP nor Composer.
Platform status
Section titled “Platform status”Be clear about where each backend stands before you choose it:
| System | Backend | Status |
|---|---|---|
| Linux | GTK 4 | The reference backend. Every example and feature was run and checked on Linux. |
| macOS | AppKit | Run on macOS 26 (x86_64) in a virtual machine without a GPU: core examples, hot reload, input, a real application and a DMG. Not run on Apple Silicon. |
| Windows | Win32, Direct2D, DirectWrite | Written against the same backend contract and type-checked by cross compilation. Not run on a real Windows machine yet: expect the first runs to need fixes. |
Platforms & Compatibility lists the status of each feature per system.
How it fits together
Section titled “How it fits together”┌──────────────────────┐ events, module results ┌──────────────────────────────┐│ PHP worker │ ◀─────────────────────── │ pam-desktop host (Rust) ││ components, state │ │ layout, scene, animations ││ render() → frames │ ───────────────────────▶ │ GTK 4 / AppKit / Win32 │└──────────────────────┘ frames, module calls └──────────────────────────────┘The host starts your entry script in a PHP worker process and talks to it over standard input and output with binary frames. For each frame the host computes the layout, diffs it against what is on screen and updates the platform views. Read Architecture for the full picture.
What ships in the box
Section titled “What ships in the box”| Area | What you get |
|---|---|
| Interface | Layout boxes, text, buttons, inputs with masks, images, scroll views, virtualized lists and grids, modals and sheets, navigation stacks and tabs, canvas, media player, embedded web view. |
| Styling | An immutable Style value in PHP, or scoped CSS in templates with state selectors, media and container queries, CSS variables, dark mode and fractional grid tracks. |
| Desktop shell | Window control, secondary windows, menu bar, context menus, tray icon, local and global shortcuts, file dialogs, notifications, drag and drop, clipboard. |
| Modules | Key/value storage, the system keychain, a private file sandbox, HTTPS, SQLite with migrations, WebSocket, timers, device status, deep links. |
| Bundled packages | DesktopUI controls, charts, Markdown, code highlighting, OAuth sign-in, SSH and terminals, printing, QR codes, Reverb channels, a durable sync outbox. |
| Shipping | Directory bundles, portable archives, AppImage, .deb, .rpm, DMG, PKG, MSIX and MSI, plus signed Ed25519 update feeds. |