PackRelay is a WordPress plugin that provides a secure REST API bridge for accepting form submissions from external applications and mobile clients. It supports multiple form builders through a provider abstraction and uses Firebase App Check to ensure request authenticity.
- Type: WordPress Plugin
- Purpose: Securely relay form submissions from mobile/external apps to WordPress form builders (Divi, WPForms, Gravity Forms).
- Core Tech: PHP 8.1+, WordPress 6.0+, Firebase App Check, Composer.
- Architecture:
- Singleton Orchestrator:
PackRelayclass inincludes/class-packrelay.php. - Provider System: Abstracted integration for form builders in
includes/providers/. - REST API: Namespace
packrelay/v1with endpoints for submission and field discovery. - Security: Server-side Firebase App Check token verification.
- Singleton Orchestrator:
- Install Dependencies:
composer install
- Run Tests:
make test # Or specifically: vendor/bin/phpunit
- Generate Production ZIP:
This command optimizes the autoloader, removes dev dependencies, and packages the plugin into
make zip
build/packrelay.zip.
- Remove Build Artifacts:
make clean
- Coding Standards: Follows WordPress Coding Standards (WPCS).
- Use Tabs for indentation.
- Use Yoda conditions (e.g.,
if ( 'value' === $var )). - Always include an
ABSPATHguard at the top of PHP files:if ( ! defined( 'ABSPATH' ) ) { exit; }
- Prefixing: Use
packrelay_for functions andPackRelay_for classes. - Testing:
- Powered by PHPUnit 10, Brain Monkey, and Mockery.
- Tests are designed to run without a full WordPress installation (using stubs).
- Test files are located in
tests/.
- Hooks:
- Registration is centralized in
PackRelay_Loader. - Custom actions like
packrelay_entry_createdand filters likepackrelay_rest_responseare available for extension.
- Registration is centralized in
packrelay.php: Main plugin file and entry point.includes/class-packrelay-rest-api.php: REST API route definitions and handlers.includes/class-packrelay-appcheck.php: Firebase App Check verification logic.includes/providers/: Concrete implementations for Divi, WPForms, and Gravity Forms.includes/class-packrelay-entry-store.php: Logic for the customwp_packrelay_entriesdatabase table.CLAUDE.md: Internal development guide and technical reference.MOBILE_INTEGRATION.md: Documentation for client-side integration (e.g., React Native).
- Submit Entry:
POST /wp-json/packrelay/v1/submit/{form_id} - Get Fields:
GET /wp-json/packrelay/v1/forms/{form_id}/fields - Authentication: Requires
app_check_tokenin the request body for submissions. - CORS: Configurable via plugin settings (Allowed Origins).