Skip to content

Project Structure

A PAM Native project is an ordinary Composer project. Your application is PHP in src/, booted by index.php, and described to the native toolchain by one manifest, pam-native.json. There is no Gradle project or Xcode project to maintain: PAM generates both hosts from the manifest on every build and keeps them out of version control.

pam init acme --template native creates:

acme/
├── index.php # entry point: boots and runs the app
├── src/ # your components, screens and services (App\ namespace)
│ └── Hello.php
├── tests/ # PHPUnit tests, run with `pam test`
│ └── ApplicationTest.php
├── composer.json # requires php ^8.5 and pushinbr/pam-native
├── composer.lock
├── phpunit.xml
├── pam.json # PAM project descriptor (project type, targets)
├── pam-native.json # native manifest: app id, name, platforms, permissions…
├── .gitignore # ignores /vendor/, /.pam/ and /.pam-native/
├── .vscode/settings.json
└── vendor/

As the app grows, the conventional layout adds a routes file and folders by role:

index.php entry point and boot (globals, middleware, run)
routes.php optional, Laravel-style routes
config/middleware.php optional, middleware aliases shared with tests
src/
Api/ Components/ Composables/ Middleware/ Screens/ Features/
Navigation/Generated/ typed route helpers written by the route compiler

index.php is the file the device runs when the app starts. It loads Composer, registers your component directory, picks a theme and hands the root component (or your routes) to App::run():

index.php
<?php
declare(strict_types=1);
use App\Hello;
use Pam\Native\App;
require __DIR__.'/vendor/autoload.php';
App::components(__DIR__.'/src', __DIR__.'/.pam-native/components');
App::theme(\Pam\Native\Theme::pamLab());
App::run(new Hello());

With routes, the last line becomes App::run(require __DIR__.'/routes.php');. See Navigation.

App::components($path, $cache) registers every .pam and .pam.php single-file component under $path and keeps the compiled templates in $cache. If you never call it, App::run() uses the convention: it scans src/ of the project root and caches in .pam-native/components. An explicit call turns the convention off.

Everything under src/ is autoloaded through PSR-4 as App\. Use the generators to create files in the conventional places:

Terminal window
pam make:screen Checkout # src/Screens/Checkout.pam
pam make:component PriceTag # src/Components/PriceTag.pam
pam make:feature Orders # src/Features/Orders/… plus a test
pam make:native-view MapPreview # an application-owned native view

Names must be PascalCase ASCII. .pam and .pam.php files are the same format: a PHP class followed by a <template> and an optional <style scoped> block. See Components.

A build bundles the project’s PHP sources and vendor/ into the app. PAM leaves out anything that no device process reads:

  • dot-files and dot-directories (.git, .pam-native, .vscode, …);
  • node_modules, target, dist and build directories;
  • host-only material of PAM packages (native sources, docs, tests, benchmarks, licenses, lock files and build scripts).

Keep large development-only files out of the project root, or inside one of the excluded directories, so they do not grow the app.

Path Created by Commit it? Contents
vendor/ Composer No Dependencies, including the PAM Native SDK.
.pam-native/ Every build and pam dev No Generated Android workspace (android/), Xcode host (ios/App), compiled component cache, runtime.lock.json, plugins.lock.json, routes.manifest.json.
.pam/ Tooling No Tool caches (for example the PHPUnit cache).
dist/ pam build, pam package, pam ios:package No Final APK, AAB and IPA files, each with a .sha256 file, plus release metadata.
artifacts/ pam screenshot, pam update:bundle, audits Your choice Screenshots (artifacts/screenshots/), OTA bundles (artifacts/pam-update.pna) and reports you write there.
src/Navigation/Generated/ The route compiler Yes RouteName and Routes, typed helpers generated from routes.php.

Builds follow the build hygiene contract: deliverables in dist/ are kept, while regenerable Gradle, Cargo and Xcode intermediates are removed when the command exits, even when it fails.

pam.json tells the PAM CLI what kind of project this is, so that short commands such as pam dev and pam test pick the right implementation:

pam.json
{
"$schema": "https://push-in.github.io/pam-docs/schemas/pam.schema.json",
"name": "acme",
"native": {
"applicationId": "com.example.acme",
"platforms": [1, 2],
"starter": 1
},
"schema": 1,
"type": 2,
"version": "0.1.0"
}

Platforms are integer codes: 1 Android, 2 iOS, 3 Android TV. They record what you chose at pam init. The targets a build actually produces live in the targets list of pam-native.json, which you change with the CLI:

Terminal window
pam add target android-tv
pam remove target ios

Only that list is rewritten; the rest of the manifest keeps its order and formatting. Valid targets are android, ios, android-tv, tizen and webos.

pam-native.json is the single source of truth for the native hosts. The CLI validates it before every build and rejects unknown keys. A freshly generated manifest looks like this:

pam-native.json
{
"$schema": "vendor/pushinbr/pam-native/resources/pam-native.schema.json",
"version": 1,
"applicationId": "com.example.acme",
"name": "Acme",
"entry": "index.php",
"runtime": { "channel": "stable", "php": "8.5" },
"versionCode": 1,
"versionName": "0.1.0",
"android": {
"minSdk": 26,
"targetSdk": 36,
"permissions": [],
"deepLinks": []
},
"ios": { "minimumVersion": "15.0" },
"modules": [],
"views": []
}

The $schema line gives you completion and validation in any JSON-Schema-aware editor. Restart pam dev after changing this file; native changes need a rebuild.

Key Default Description
version required Manifest format. Always 1.
applicationId required Reverse-DNS id, the Android package and default iOS bundle id.
name required Name shown to the user. On iOS the executable uses an ASCII spelling of it; the display name keeps it exactly.
entry required Entry script, relative to the project (normally index.php).
runtime.php "8.5" Device PHP series: "8.4" or "8.5".
runtime.channel "stable" Runtime channel. Only stable exists.
versionCode 1 Integer build number. Increase it for every store upload.
versionName Human-readable version, such as "1.4.0".
targets ["android", "ios"] Where the app ships: android, ios, android-tv, tizen, webos.
devErrorOverlay true Runtime error overlay: true/"debug" (debug builds), false/"off" (never), "always" (also in release, for internal QA). See Debugging.
appearance Light and dark window colors before the first PHP frame, splash logo, and default mode. See Theming.
theme.tokens Project-relative .css file of :root { --token: value; } declarations that component libraries resolve their tokens from.
modules, views [] Application-owned native modules and views, as { "name": "acme.weather", "class": "com.example.acme.WeatherModule" }. See Native Views.
plugins Per-plugin configuration, keyed by the configKey a plugin declares.
links.schemes Custom URI schemes for incoming links (myapp://chat/5).
links.hosts HTTPS hosts for Android App Links and iOS universal links.
links.autoVerify true Android autoVerify for those hosts.
linking.openSchemes Extra schemes Linking::open() may hand to other apps (besides https, http, mailto, tel, geo).
routes.file "routes.php" Routes file compiled before every build.
routes.namespace "App\\Navigation\\Generated" Namespace of the generated route helpers.
routes.output "src/Navigation/Generated" Directory of the generated route helpers.
Key Default Description
minSdk 26 Lowest Android API level (24–36).
targetSdk 36 Target API level (26–36). pam doctor --fix installs this platform.
permissions [] Extra android.permission.* entries. Plugins add their own. See Permissions.
deepLinks [] Manual intent filters: { "scheme", "host", "pathPrefix", "autoVerify" }. Prefer links, which derives them from your routes.
shareTargets Up to 16 MIME types ("image/*") the app accepts from the system share sheet.
orientations Any of portrait, portraitUpsideDown, landscapeLeft, landscapeRight. Omit to follow the sensor.
pictureInPicture false Declares Picture-in-Picture support on the main activity.
queries.packages, queries.intents Android 11+ package visibility, for example to check whether another app is installed.
safeAreaBottomFallback 0 Bottom inset in dp (0–96) used when Android reports none on some gesture-navigation setups.
icon.foreground, icon.background, icon.monochrome Adaptive launcher icon layers. The foreground is a PNG/WebP of at least 432 px; the background is a color or an image.
tv.banner, tv.overscan Android TV launcher banner (320×180 PNG) and 5% overscan margins (default true).
debugApplicationIdSuffix Suffix of the debug package id.
benchmarkApplicationIdSuffix Suffix of the installable release-optimized build used for benchmarks.
debugFirebase true Set false to build debug variants without Firebase Messaging.
Key Default Description
minimumVersion "15.0" Lowest iOS version.
icon Project-relative 1024×1024 PNG for the home screen and App Store.
bundleIdentifier iOS bundle id when it differs from applicationId.
usageDescriptions Privacy strings, such as NSCameraUsageDescription. iOS terminates an app that requests a protected resource without one.
urlSchemes Custom URL schemes (up to 32).
associatedDomains Universal-link entitlements such as applinks:example.com.
orientations Same values as android.orientations.
developmentRegion "en" Language of the app’s own texts (BCP 47), used by system UI.
localizations Languages the app is localized in.
pam-native.json
{
"$schema": "vendor/pushinbr/pam-native/resources/pam-native.schema.json",
"version": 1,
"applicationId": "com.example.acme",
"name": "Acme",
"entry": "index.php",
"versionCode": 12,
"versionName": "1.4.0",
"targets": ["android", "ios"],
"android": {
"minSdk": 26,
"targetSdk": 36,
"orientations": ["portrait"],
"icon": { "foreground": "resources/icon-foreground.png", "background": "#0F172A" }
},
"ios": {
"minimumVersion": "15.0",
"icon": "resources/icon-ios.png",
"usageDescriptions": {
"NSCameraUsageDescription": "Acme uses the camera to scan receipts."
}
},
"appearance": {
"defaultMode": "system",
"light": { "background": "#FFFFFF" },
"dark": { "background": "#0F172A" }
},
"links": { "schemes": ["acme"], "hosts": ["app.example.com"] }
}