The command-line tool that builds, flashes and monitors PHP firmware. It runs on your computer and drives an SDK, which knows the chip; Composer and the conductor plugin pick the packages.
phpbm turns a Composer project into firmware for a microcontroller. It runs on Linux, macOS or Windows, never
on the board. phpbm itself knows nothing about a chip: an SDK (today esp32, from php-esp32-sdk) brings
the boards, the PHP build recipe, the runtimes and the toolchain, and phpbm downloads, verifies and drives it.
How the pieces fit
| Piece | Role |
|---|---|
| Your project | A composer.json with extra.baremetal (SDK, board, runtime, storage) and the PHP sources in project-src/. |
| Composer + conductor | composer require picks the packages (extensions, drivers, PHP extensions). The php-baremetal/conductor plugin installs them into .phpbm/packages/, adds the HAL for the SDK's platform and writes .phpbm/manifest.json. |
| phpbm | Reads the manifest, resolves and locks the SDK (phpbm.lock), checks the project against it, then builds, flashes, syncs and monitors. |
| SDK | Describes the boards, chips, runtimes, storages and options, and carries the driver phpbm calls to build and flash. |
| Toolchain | The SDK's compiler and flashing tools (ESP-IDF for esp32), installed by phpbm toolchain:install. |
The packages come from the registry. phpbm, the conductor and the spec library they share are on Packagist; SDKs are GitHub releases listed in a release index.
Requirements
- PHP 8.4 or later with the
fileinfoextension (ziprecommended), and Composer 2. git, used to apply the SDK's patches to the PHP sources.- Whatever the SDK's toolchain needs. For
esp32: Python 3.10 or later and about 6 GB of disk for ESP-IDF.
ESP-IDF does not work from a path with spaces or non-ASCII characters. Keep your projects, and PHPBM_HOME if
you move it, on a path without them.
Install
phpbm installs with Composer or as a single PHAR file. The conductor must be installed globally either way: it has to be active while Composer resolves a project for the first time.
- Composer: Composer's global
vendor/binmust be on yourPATH(composer global config bin-dir --absoluteprints it). - PHAR: needs the same PHP, with the
pharandzlibextensions (enabled in most PHP builds). Each release hasphpbm.pharandSHA256SUMS; replacelatest/downloadwithdownload/v1.0.0to pin a version, and download a new PHAR over the old one to update.
Where next
- Getting started: from an empty machine to a running board.
- The project: every
extra.baremetalkey. - Project commands and SDK commands: every option.
Documentation
Overview
Reference