Skip to content

About

The official PHP 8.3-8.5 engine running on an ESP32-P4/ESP32-S3. No emulation, no clone: reads a PHP file from microSD and runs it.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

62 stars

Watchers

3 watching

Forks

Repository files navigation

php-esp32

License PHP 8.3 | 8.4 | 8.5 | 8.6 ESP-IDF v6.1.1 Targets: ESP32-P4 | S3 Stars

PHP on ESP32

The ESP32 SDK of php-baremetal: it runs the real, unmodified PHP engine on ESP32-S3 and ESP32-P4 boards. You do not use this repository directly: phpbm downloads a release of it, and your project picks it with "sdk": "esp32@^2.0".

Note

2.0 is a rewrite: the firmware is now a Composer project built by phpbm, and hardware features are packages from the registry. The 1.x firmware is in the v1.5.0 and older tags.

Quick start

composer global require php-baremetal/phpbm php-baremetal/conductor
phpbm sdk:install esp32
phpbm init blink && cd blink
composer require php-baremetal/ext-gpio php-baremetal/ext-sys
phpbm toolchain:install          # ESP-IDF v6.1.1, once per machine
phpbm flash && phpbm monitor

The SDK documentation covers the boards, the runtimes, storage and network, every option, PHP and its extensions, memory and power saving, and how to work on the SDK. The phpbm documentation covers the project format and every command.

What the SDK provides

PHP 8.3, 8.4, 8.5, 8.6 (built from the php.net release plus build-time patches)
Runtimes init-loop, event-driven, web-server
Storage embedded (in flash), microsd
Options network, on-error, restart-delay, firmware-reserve, optimization, power-save, request-timeout
PHP extensions bcmath, ctype, date, filter, mbstring, opcache, openssl, pdo, pdo_sqlite, session, sqlite3, tokenizer, zlib, each enabled by its php-baremetal/php-<name> package

Boards

Board id Board Chip Network
espressif-esp32-s3-devkitc-1-n8r2 Espressif ESP32-S3-DevKitC-1 (N8R2) ESP32-S3 Wi-Fi
espressif-esp32-s3-devkitc-1-n8r8 Espressif ESP32-S3-DevKitC-1 (N8R8) ESP32-S3 Wi-Fi
espressif-esp32-s3-devkitc-1-n16r8 Espressif ESP32-S3-DevKitC-1 (N16R8) ESP32-S3 Wi-Fi
generic-esp32s3-quad, generic-esp32s3-octal, generic-esp32p4 Any ESP32-S3 (quad or octal PSRAM) or ESP32-P4

The Arduino Nano ESP32 (arduino-nano-esp32, with its pin names D0-D13, A0-A7 as Baremetal\Board\Pin constants) is in the board package php-baremetal/boards-arduino. The Seeed Studio XIAO ESP32-S3 (seeed-xiao-esp32s3, with its pin names D0-D10, A0-A10) is in the board package php-baremetal/boards-seeed.

The Freenove boards are in the board package php-baremetal/boards-freenove: phpbm init adds it when you pick one of them, or run composer require php-baremetal/boards-freenove in the project.

Board id Board Chip Network
freenove-esp32-s3-wroom-lite-n16r8 Freenove ESP32-S3 WROOM Board Lite (N16R8) ESP32-S3 Wi-Fi
freenove-esp32-s3-wroom-lite-n16r16 Freenove ESP32-S3 WROOM Board Lite (N16R16) ESP32-S3 Wi-Fi

The Waveshare boards are in the board package php-baremetal/boards-waveshare: phpbm init adds it when you pick one of them, or run composer require php-baremetal/boards-waveshare in the project.

Board id Board Chip Network
waveshare-esp32-s3-zero Waveshare ESP32-S3-Zero ESP32-S3 Wi-Fi
waveshare-esp32-s3-zero-n8r8 Waveshare ESP32-S3-Zero (N8R8) ESP32-S3 Wi-Fi
waveshare-esp32-s3-eth Waveshare ESP32-S3-ETH ESP32-S3 Ethernet (W5500)
waveshare-esp32-s3-touch-lcd-1.85b Waveshare ESP32-S3-Touch-LCD-1.85B ESP32-S3 Wi-Fi
waveshare-esp32-s3-touch-lcd-5b Waveshare ESP32-S3-Touch-LCD-5B ESP32-S3 Wi-Fi
waveshare-esp32-p4-eth Waveshare ESP32-P4-ETH ESP32-P4 Ethernet
waveshare-esp32-p4-pico Waveshare ESP32-P4-Pico ESP32-P4 —
waveshare-esp32-p4-wifi6 Waveshare ESP32-P4-WIFI6 ESP32-P4 Wi-Fi (ESP32-C6)
waveshare-esp32-p4-wifi6-touch-lcd-5 Waveshare ESP32-P4-WIFI6-Touch-LCD-5 ESP32-P4 Wi-Fi (ESP32-C6)

Every board needs external PSRAM. phpbm discover shows which boards match the connected chip.

Contributing

Boards, PHP extensions and fixes are welcome: see CONTRIBUTING.md, the AI usage policy and the security policy. Extensions, HALs and drivers live in their own repositories, linked from the registry.

AI usage

AI is used as a tool here, on top of human engineering — the architecture, the design decisions and the hardware bring-up are done by hand; AI mostly helps with the docs/website prose and with mechanical, verifiable work. The full policy, and what's expected of contributions made with it, is in AI_USAGE.md.

Not for you? No worries at all — nobody's forcing it on you, and a free, open-source project you didn't spend a minute or a cent on owes you no explanation anyway. Take it or leave it, no hard feelings.

And for everyone who's on board: when contributing, you're kindly asked to follow the guidelines in AI_USAGE.md. Thanks!

License

MIT, see LICENSE. The PHP source fetched at build time stays under the PHP License.

About

The official PHP 8.3-8.5 engine running on an ESP32-P4/ESP32-S3. No emulation, no clone: reads a PHP file from microSD and runs it.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

62 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages