Installation
PAM Native builds real Android and iOS applications from PHP. Your PHP code runs inside the app on an embedded PHP runtime, so the device needs no server and no WebView. To build those apps, your machine needs three things:
- the PAM CLI, which creates projects, runs Composer and drives every build;
- the Android toolchain (Java and the Android SDK) to build Android apps on Linux, macOS or Windows;
- Xcode on a Mac to build iOS apps.
You do not install PHP, Composer, Gradle or Rust yourself. PAM ships a private PHP
runtime and Composer, the Android build uses the Gradle wrapper of the generated
host, and the native engine comes prebuilt. pam doctor --fix downloads the
verified PHP runtimes and the renderer the first time you need them.
Install the PAM CLI
Section titled “Install the PAM CLI”Run the official installer:
curl --proto '=https' --proto-redir '=https' --tlsv1.2 \ --connect-timeout 15 --max-time 60 --max-filesize 1048576 \ --fail --silent --show-error --location \ https://pamphp.com/install | shThe installer links pam into ~/.local/bin. If your shell cannot find it, add
that directory to your PATH (most distributions do so at the next login), then
check the installation:
pam --versionpam doctorPAM does not put a php executable on your PATH. Run Composer through
pam composer ... and package commands through pam <command>. Keep the CLI
current with pam self-update.
Android toolchain
Section titled “Android toolchain”Android apps build on Linux, macOS and Windows hosts. PAM Native needs:
| Requirement | Version | How you get it |
|---|---|---|
| Java (JDK) | 17 or newer | Your package manager or the JDK bundled with Android Studio |
| Android SDK with Command-line Tools | latest | Android Studio → SDK Manager → SDK Tools |
| Android platform | API 36 (your targetSdk) |
Installed by pam doctor --fix |
| Android NDK | 27.1.12297006 |
Installed by pam doctor --fix |
| CMake | 3.22.1 |
Installed by pam doctor --fix |
Platform tools (adb) |
latest | Installed by pam doctor --fix |
Install Java and Android Studio (or only the command-line tools), then make sure
PAM can find the SDK. PAM reads ANDROID_HOME, then ANDROID_SDK_ROOT, and
finally falls back to ~/Android/Sdk.
export ANDROID_HOME="$HOME/Android/Sdk"export PATH="$ANDROID_HOME/platform-tools:$PATH"export ANDROID_HOME="$HOME/Library/Android/sdk"export PATH="$ANDROID_HOME/platform-tools:$PATH"The SDK Manager must include Android SDK Command-line Tools (latest). PAM uses
its sdkmanager to accept licenses and install the remaining components; without
it, pam doctor --fix stops and tells you to install it.
Let PAM repair the machine
Section titled “Let PAM repair the machine”Inside a PAM Native project (see Your First App), run:
pam doctor --fixThe repair step is idempotent. It:
- downloads the PHP runtime for every Android ABI (
arm64-v8a,armeabi-v7a,x86andx86_64) and verifies each archive’s SHA-256; - downloads the prebuilt native renderer that matches your
pushinbr/pam-nativeversion, so you never need Rust to build an app; - asks you to accept the Android SDK licenses and installs the platform, NDK, CMake and platform tools listed above;
- records the selected runtime in
.pam-native/runtime.lock.json.
Then pam doctor (without --fix) checks everything and exits non-zero if
something is still missing:
Pam Native Android doctor
[ok] Native SDK /home/alice/acme/vendor/pushinbr/pam-native[ok] Project Acme (com.example.acme)[ok] Debug application ID com.example.acme.debug[ok] Java 17+ openjdk version "17.0.19"[ok] Android SDK /home/alice/Android/Sdk[ok] Android NDK 27.1.12297006[ok] Android platform android-36[ok] CMake 3.22.1[ok] ADB Android platform-tools[ok] PHP 8.5.12 runtime (arm64-v8a) ...[ok] Native engine (arm64-v8a) ...
Pam Native is ready to build Android applications.iOS toolchain
Section titled “iOS toolchain”iOS apps build only on macOS. You need:
- Xcode with its command-line tools selected (
xcode-select), including the iOS Simulator; - the Rust targets that
pam ios:doctorchecks:aarch64-apple-ios,aarch64-apple-ios-simandx86_64-apple-ios.
Check the Mac from inside a project:
pam ios:doctorThe doctor validates the macOS host, Xcode, simctl, the iOS PHP runtime and the
Rust targets. Every missing target line prints the exact fix, for example
run: rustup target add aarch64-apple-ios-sim. The iOS PHP runtime is downloaded
on the first pam ios:prepare, which also generates the self-contained Xcode host
in .pam-native/ios/App. The host uses Swift Package Manager; CocoaPods is not
needed.
PHP runtimes
Section titled “PHP runtimes”Each app pins the PHP series it ships in pam-native.json:
{ "runtime": { "php": "8.5", "channel": "stable" }}8.5 is the default; 8.4 is also available. Inspect and change the runtime with
the runtime commands:
pam runtime:list # installed runtimes, the selected one marked with *pam runtime:info # PHP version, revision, NDK and compiled extensionspam runtime:use 8.4 # switch the project to another seriespam runtime:update # move to the newest revision of the selected seriespam runtime:info lists the extensions compiled into the device runtime
(for example ctype, filter, opcache, phar, session, tokenizer and
uri in PHP 8.5). The device runtime is deliberately small; see
Architecture for how features such as
multibyte strings and cryptography reach your code.
Editor support
Section titled “Editor support”Install syntax highlighting, diagnostics, completion and format-on-save for
.pam component files:
pam editor:install vscodeNeovim and Helix are supported too; see Editor Setup.
Next steps
Section titled “Next steps”- Your First App: create a project and run it on a device or emulator.
- Project Structure: what every generated file does.
- Debugging: logs, diagnostics and the error overlay.