pushinbr / pam-native-devtools
Deterministic temporal replay, state, network and frame diagnostics for PAM Native.
Requires
- php: ^8.5
- ext-json: *
- pushinbr/pam-native: ^0.8 || ^0.9 || ^0.10 || ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
See every state transition, and replay it deterministically.
A bounded, redacted recorder for events, snapshots, mutations, frames, performance marks, errors and network work. Export one JSON artifact for bug reports or CI.
Install · Quick example · API · Checklist · Docs · Issues
Install
Inside a PAM Native project:
pam composer require pushinbr/pam-native-devtools pam doctor --fix
This package is plain PHP (no plugin manifest, no native permissions); pam doctor --fix validates the environment and regenerates native integration when required. New to PAM? Create a project with pam init my-app --template native and run it with pam mobile dev (see the PAM Native overview), then come back here. Composer owns the manifest and the lockfile; pam composer runs it on PAM's verified PHP runtime. Remove it with pam composer remove pushinbr/pam-native-devtools.
Quick example
<?php use Pam\Native\DevTools\DevTools; use Pam\Native\DevTools\ReplaySession; use Pam\Native\DevTools\TimelineRecording; $tools = new DevTools(); $tools->snapshot('session', $session); $tools->mutation('session', $previousSession, $session); $tools->frame('feed', ['refreshRateHz' => 120, 'frameMs' => 7.4, 'missed' => false]); $tools->mark('feed.start'); $request = $tools->network('GET', $url, $headers); try { $request->complete(200, $responseHeaders, $body); } catch (Throwable $e) { $request->fail($e->getMessage()); throw $e; } $tools->measure('feed.load', 'feed.start'); $artifact = $tools->exportJson(); $recording = TimelineRecording::fromJson($artifact); $replay = new ReplaySession($recording); $replay->replay(static function (array $record): void { // Feed the exact, ordered diagnostic event into a test or inspector. });
Sensitive keys are redacted recursively, object depth and collection size are bounded, strings are truncated, and the oldest records are discarded under pressure. The package complements PAM's native debug overlay and navigation timeline; it does not ship UI into production applications.
Platform support
| Platform | Support | Notes |
|---|---|---|
| PAM Native | ^0.8 || ^0.9 || ^0.10 || ^1.0 |
From composer.json |
| PHP | 8.5+ | Requires ext-json |
| Android / iOS | Whatever the PAM Native host supports | Pure PHP: no plugin manifest, permissions or native code of its own |
API guide
| API | Responsibility |
|---|---|
DevTools |
Record events, mutations, snapshots, frames, marks, measures, errors, and network work. |
NetworkTransaction |
Complete, fail or cancel a captured request lifecycle. |
Redactor |
Bound and recursively redact diagnostic values. |
TimelineRecording |
Validate and serialize the bounded, versioned replay artifact. |
ReplaySession |
Step, seek, time travel to state, or replay the timeline deterministically. |
RecordKind / NetworkState |
Typed diagnostic record states. |
All coded states, kinds, and variants are sequential integer-backed enums. Use enum cases in application code; do not depend on raw wire numbers.
Production checklist
- Keep DevTools in development and diagnostic builds.
- Add product-specific sensitive keys to redaction rules.
- Attach exported JSON to reproducible bug reports, never public issue bodies without review.
- Run
pam doctor,pam test, and a signed release build on every supported platform. - Exercise denial, cancellation, backgrounding, process restart, and offline behavior before release.
Troubleshooting
- Records disappear: the buffer intentionally drops oldest entries under pressure.
- Values are truncated: increase detail only when the privacy and size trade-off is acceptable.
- A request remains open: always call
complete(),fail()orcancel(). - Native integration is stale: run
pam doctor --fix, rebuild the native host, and inspect the first reported diagnostic.
Report security vulnerabilities through the repository security policy or GitHub private vulnerability reporting, not a public issue.
Docs
- Package guide on pam-docs
- PAM Native overview
- Plugin and native capability model
- Changelog
- Report an issue
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · Made in Brazil by Pushin