PHP API, Hooks & CLI
ProcessReactExportProfile exposes its domain coordinator via $modules->get('ProcessReactExportProfile')->runtime() (Totoglu\ProcessReactExportProfile\ExportProfileRuntime), one extension hook (ProcessReactExportProfile::collectContributors), one background queue (ExportProfileQueue), and 4 CLI commands.
ExportProfileRuntime Key Methods
Section titled “ExportProfileRuntime Key Methods”| Method | Description |
|---|---|
ExportProfileRuntime::make(ProcessWire $wire) |
Instantiates and wires a runtime coordinator. |
collector(), repository(), presetStore(), auditor(), verifier(), runner() |
Accessors for the underlying domain services. |
collectRulesWithModuleHook() |
Collects and merges all contributor rules including ProcessReactExportProfile::collectContributors. |
runAudit(?ExportPlan $plan = null) / getCachedAudit(bool $forceRefresh = false) |
Runs or reads the 60-second cached pre-flight site audit. |
invalidateAuditCache() |
Clears the cached audit snapshot in WireCache. |
buildDefaultPlan(array $auditReport, MergedContributorRules $rules) |
Builds a safe default ExportPlan from live site discovery. |
validatePlan(ExportPlan $plan) |
Validates an ExportPlan and returns localized error messages. |
dispatchQueueExport(ExportPlan $plan, bool $allowCustomFinishPhp = false) |
Dispatches an asynchronous ExportProfileQueue job. |
verifyProfile(string $slug, bool $persistMetadata = false) |
Runs ProfileVerifier on an exported profile and optionally updates saved metadata. |
redactPathsForNonSuperuser(array $payload, bool $isSuperuser) |
Strips host root paths for non-superuser responses. |
audit(string $action, string $outcome, array $context = []) |
Writes a structured record to react-export-profile-audit. |
Process Module Hookable Methods
Section titled “Process Module Hookable Methods”| Hook | Arguments & Return | Timing | What It Does |
|---|---|---|---|
ProcessReactExportProfile::collectContributors |
(ContributorCollector $collector): void |
After | Fires during audit and export planning so modules can register custom ProfileContributorInterface rules (extra excluded tables, secret key patterns, or post-install hooks). |
ProcessReactExportProfile::translations |
(): array |
After | Returns the localized UI string dictionary for the Setup -> Export Site Profile React workspace. |
Register a Custom Export Contributor & Override Workspace Labels
Section titled “Register a Custom Export Contributor & Override Workspace Labels”<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\ProcessReactExportProfile\Contributor\ContributorCollector;
$wire->addHookAfter('ProcessReactExportProfile::collectContributors', function (HookEvent $event): void { /** @var ContributorCollector $collector */ $collector = $event->arguments(0); $collector->register(new AegeanVoyagesProfileContributor());});
$wire->addHookAfter('ProcessReactExportProfile::translations', function (HookEvent $event): void { $strings = (array) $event->return; $strings['workspace.title'] = 'Aegean Profile Exporter'; $event->return = $strings;});All 4 CLI Commands & Flags (vendor/bin/wire)
Section titled “All 4 CLI Commands & Flags (vendor/bin/wire)”1. profile:audit
Section titled “1. profile:audit”Runs a full pre-flight audit reporting tables, detected secrets, dev junk, and contributor rules:
php vendor/bin/wire profile:audit --jsonFlags: --json.
2. profile:export
Section titled “2. profile:export”Exports a site profile using a built-in or saved preset, either synchronously or via ExportProfileQueue:
php vendor/bin/wire profile:export \ --preset=client-handoff \ --target=aegean-voyages-handoff \ --mode=zip \ --title="Aegean Voyages Starter" \ --summary="Sanitized Aegean yacht charter starter" \ --queue \ --dry-run \ --force \ --json| Flag | Description |
|---|---|
--preset |
Built-in (public-starter, client-handoff, internal-clone) or custom site/profiles/*.json preset slug. |
--target |
Output profile slug (site-{target}). |
--mode |
Output mode (both, directory, or zip). |
--title |
Profile display title written to install/info.php. |
--summary |
Profile summary written to install/info.php. |
--queue |
Dispatch the export asynchronously via ExportProfileQueue. |
--include-users |
Include user accounts (superuser-only; omitted by default). |
--no-scrub-secrets |
Disable automatic secret scrubbing (superuser-only; never use for public profiles). |
--dry-run |
Validate and preview the export plan without writing files. |
--force |
Overwrite existing profile or skip interactive confirmation in CI. |
--json |
Emit structured JSON result. |
3. profile:list
Section titled “3. profile:list”Lists all exported profiles, sizes, verification statuses, and available presets:
php vendor/bin/wire profile:list --jsonFlags: --json.
4. profile:verify
Section titled “4. profile:verify”Runs ProfileVerifier on an exported profile directory and/or ZIP archive to verify installer files and zero leaked secrets:
php vendor/bin/wire profile:verify aegean-voyages-handoff --jsonFlags: --json.
Troubleshooting
Section titled “Troubleshooting”Export Fails With ext-zip Missing
Section titled “Export Fails With ext-zip Missing”Symptom: ZIP archive creation fails in FileArchiver::archiveDirectoryToZip().
Fix: Install and enable PHP’s ext-zip extension, or export with --mode=directory if you only need a server directory copy.
ProfileVerifier Flags a Residual Secret
Section titled “ProfileVerifier Flags a Residual Secret”Symptom: profile:verify reports a secret literal match inside a template or custom module file.
Fix: Move hardcoded keys out of site/templates/ into environment variables or site/config.php (which ConfigCompiler scrubs automatically), or register the custom key name via ProfileContributorInterface and re-export.
Queue Worker, Demo Mode & Localization
Section titled “Queue Worker, Demo Mode & Localization”-
Running
ExportProfileQueue: When exporting with--queueor via the Workbench background mode, ensure atrk/processwire-consoleworker is active:Terminal window php vendor/bin/wire queue:work --tries=3 --sleep=3 -
Demo Mode (
$config->demo = true): Blocks destructive profile deletions, raw archive exports containing sensitive settings, and customfinish.phphooks. -
6-Locale Translation Packs: Bundled CSV packs (
en,tr,de,fr,es,ru) live insite/modules/ProcessReactExportProfile/languages/. Import the matching.csvfile under Setup -> Languages -> [Language] -> Site Translation Files.