Zend engine · PHP 8.3–8.5 ESP32-S3 · ESP32-P4 today

Real PHP,
flashed onto
silicon.

The upstream Zend engine from php.net, cross-compiled for the chip and booting straight into your index.php. Not a subset. Not a reimplementation. Not a transpiler.

phpbm init blink
Read the docs

PREVIEW phpbm and the 2.0 SDK are previews, not ready for production. Need something stable today? Stay on the 1.x firmware (tag v1.5.0).

Fig. 1 — Your index.php is the firmware. GPIO2 follows the blink sketch below.
PHP
8.3 – 8.5
Chips
2
SDKs
1
PSRAM
2–32 MB
Install via
Composer
License
MIT
01 — Block diagram

The same PHP.
Different ground.

Nothing between your code and the chip has been rewritten. The official engine runs through the official embed SAPI, with the standard library and real extensions compiled in.

  • AComposer works: stock Laravel and Symfony apps served over HTTP from an ESP32-P4.
  • BCode lives on microSD or embedded in flash.
  • CHardware extensions are Composer packages: composer require php-baremetal/ext-gpio.
L3

The official interpreter from the php.net release, cross-compiled for the chip with a few build-time patches. Nothing re-implemented.

Fig. 2 — Hover or tap a layer. Orange = php.net source.

02 — Hello, hardware

Blink an LED
in ten lines of PHP.

A Composer project and an Arduino-style sketch: setup() runs once, loop() runs forever. Press run, drag the delay: the code, the LED, the trace and the pin on Fig. 1 follow along.

blink — phpbm project esp32 · init-loop · embedded
Fig. 2 — on the bench ESP32-S3-Zero
GPIO2 · STATE $tick = 0 → LOW
CH0 · GPIO2logic
← pastnow
  1. 01 · Scaffold $ phpbm init blink && cd blink
  2. 02 · Add the extensions $ composer require php-baremetal/ext-gpio php-baremetal/ext-sys
  3. 03 · Toolchain, once $ phpbm toolchain:install
  4. 04 · Flash and watch $ phpbm flash && phpbm monitor
03 — Virtual bench

No board?
Run it in
your browser.

sim.php-baremetal.com emulates an ESP32-S3 in QEMU, right in the browser. It runs real firmware, built by phpbm with the esp32 SDK: the same engine your board would boot. Open an example like the blink, edit index.php and composer.json, and try it before you own any hardware.

VIRTUAL BENCH · SIM.PHP-BAREMETAL.COM GPIO2
  1. 01 · SOURCE index.php + composer.json An example from the gallery, or your edit of it.
  2. 02 · BUILD phpbm build php-esp32-sdk compiles the real firmware image.
  3. 03 · EMULATE ESP32-S3 · QEMU The image boots on an emulated chip with PSRAM.
  4. 04 · WATCH pins + console No board, no cable, no toolchain on your machine.
Fig. 3 — The simulator runs the firmware phpbm builds. Based on the open-source Velxio simulator.
04 — Execution models

One line of config.
Three ways to run.

Pick a runtime in composer.json → extra.baremetal and the SDK wraps it around your code. PHP runs on core 1; the firmware's own tasks run on core 0.

MODE Ainit-loop

Sketch

REQUIRES
nothing
POWER-SAVE
light sleep between loop() calls

setup() once, then loop($tick) forever. Firmware-style control of pins and peripherals.

MODE Bweb-server

Per request

REQUIRES
a board with a network
STATE
fresh for every request

An HTTP server that runs index.php per request: the PHP you already know, from a chip on your desk.

MODE Cevent-driven

Reactor

REQUIRES
ext-events
POWER-SAVE
light sleep between events

A resident reactor: firmware tasks on core 0 catch timer, GPIO, HTTP and WebSocket events and hand them to your PHP listeners on core 1.

The diagrams are schematic, not measurements. Light sleep needs the SDK's power-save option.

05 — On board

What ships
in the firmware.

Real extensions, not stubs. Networking, storage and state built for a device that never reboots on purpose.

P01 · NET

Wi-Fi from PHP

ext-wifi scans, joins a network or opens an access point. On the ESP32-P4-WIFI6 through its ESP32-C6 companion.

P02 · NET

HTTP + WebSocket

Serve pages with the web-server runtime, or keep state with ext-web and push to every client with ws_broadcast().

P03 · DB

SQLite through PDO

pdo_sqlite and sqlite3 compiled into the engine. Eloquent runs on an ESP32-P4 with its database on the card.

P04 · MEM

State that survives

store_* keeps keys in flash across resets; mem_* shares values in RAM between the requests of one boot.

P05 · FS

microSD or flash

Ship code on a card for quick swaps (phpbm sync), or embed it in flash.

P06 · IO

GPIO extension

Pins, inputs and outputs as plain PHP function calls: gpio_mode(), gpio_write(), gpio_read().

P07 · EVT

Events and sensors

Timers, pin and button watchers; ext-i2c samples sensors in the background and hands readings to PHP as events.

P08 · EXT

Extensions via Composer

Hardware extensions like ext-gpio and ext-sys install with composer require. The conductor adds the HAL for your chip.

PHP EXTENSIONS bcmath ctype date filter mbstring opcache (no JIT) openssl (ciphers) pdo pdo_sqlite session sqlite3 tokenizer zlib
HARDWARE ext-gpio ext-sys ext-wifi ext-web ext-events ext-i2c ext-spi ext-led ext-store ext-mem
06 — Architecture

One tool.
Pluggable silicon.

phpbm knows nothing about chips. Each SDK brings its boards, PHP build recipe, runtimes and toolchain; phpbm downloads, verifies and drives it. ESP32 is the first. STM32, NXP and RP2350 are planned: same project, same commands.

HOST · YOUR COMPUTER v0.3.x · PREVIEW

phpbm

You're too curious come back at the end of November

init build flash sync monitor discover sdk:install toolchain:install
SDK SLOTS
php-esp32-sdk sdk: esp32 · ESP32-P4, ESP32-S3 · 12 boards · ESP-IDF v6.1
2.0 PREVIEW
STM32 STMicroelectronics · Arm Cortex-M
PLANNED
NXP NXP microcontrollers · Arm Cortex-M
PLANNED
RP2350 Raspberry Pi · Arm Cortex-M33 / RISC-V
PLANNED
07 — Parts bin

Every part,
one registry.

repository.php-baremetal.com is the official Composer registry for the bm-* packages. phpbm init wires it into your composer.json; then it's just composer require.

Extensions
14
PHP functions and classes written in C.
Libraries
10
Shared C code, device drivers and assets.
HALs
9
The platform side of an extension, one per SDK.
PHP extensions
13
Engine extensions like pdo and mbstring, compiled by the SDK.
EXTENSION · PHP API php-baremetal/ext-gpio What your PHP calls. Same on every chip.
VIRTUAL HAL · INTERFACE php-baremetal/gpio-hal The contract every SDK implements.
$composer require php-baremetal/ext-gpio→ resolves php-baremetal/esp32-gpio-hal · builds today
Fig. 4 — Pick a target. Write against the extension once; each SDK ships the HAL underneath, and the conductor picks it for you.

Four steps
to first blink.

  1. 01 Install phpbm + SDK composer global require php-baremetal/phpbm php-baremetal/conductor phpbm sdk:install esp32
  2. 02 Scaffold a project phpbm init blink
  3. 03 Add extensions composer require php-baremetal/ext-gpio php-baremetal/ext-sys
  4. 04 Flash it phpbm toolchain:install phpbm flash