Skip to content

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.

Run the official installer:

Terminal window
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 | sh

The 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:

Terminal window
pam --version
pam doctor

PAM 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 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.

~/.bashrc
export ANDROID_HOME="$HOME/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.

Inside a PAM Native project (see Your First App), run:

Terminal window
pam doctor --fix

The repair step is idempotent. It:

  1. downloads the PHP runtime for every Android ABI (arm64-v8a, armeabi-v7a, x86 and x86_64) and verifies each archive’s SHA-256;
  2. downloads the prebuilt native renderer that matches your pushinbr/pam-native version, so you never need Rust to build an app;
  3. asks you to accept the Android SDK licenses and installs the platform, NDK, CMake and platform tools listed above;
  4. 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 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:doctor checks: aarch64-apple-ios, aarch64-apple-ios-sim and x86_64-apple-ios.

Check the Mac from inside a project:

Terminal window
pam ios:doctor

The 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.

Each app pins the PHP series it ships in pam-native.json:

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:

Terminal window
pam runtime:list # installed runtimes, the selected one marked with *
pam runtime:info # PHP version, revision, NDK and compiled extensions
pam runtime:use 8.4 # switch the project to another series
pam runtime:update # move to the newest revision of the selected series

pam 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.

Install syntax highlighting, diagnostics, completion and format-on-save for .pam component files:

Terminal window
pam editor:install vscode

Neovim and Helix are supported too; see Editor Setup.