A single-file PHP REST client for the Integrity WordPress plugin API — access to Unity intergroup Groups, Meetings, Positions, Members and Intergroup Meetings.
This repository was extracted from integrity/client/php/ so the client can be
versioned and consumed independently of the WordPress plugin.
- PHP 8.1+ (uses
readonlypromoted properties anddeclare(strict_types=1)) - ext-curl / ext-json
| File | Purpose |
|---|---|
IntegrityClient.php |
The client and its response DTOs (IntegrityClient, Group, Meeting, ApiResponse, RateLimit, …). |
client-example.php |
A runnable example exercising the main endpoints. |
<?php
require_once __DIR__ . '/IntegrityClient.php';
$client = new IntegrityClient(
baseUrl: 'https://your-wordpress-site.com',
apiKey: 'int_your_api_key_here',
timeout: 30,
);
// Health check (no auth required)
$health = $client->checkHealth();
echo "Unity available: " . ($health->data->unityAvailable ? 'yes' : 'no') . "\n";
// List groups
$groups = $client->getGroups(new GroupsQuery(page: 1, perPage: 50));
foreach ($groups->data as $group) {
echo "[{$group->id}] {$group->title}\n";
}The write endpoints (member create / update / compliance and the intergroup
register / unregister calls) can be sent together in one HTTP call through
WordPress core's /wp-json/batch/v1. Requires Integrity 2.1+ on the site;
batches of more than 25 requests need Integrity 2.2+, which raises core's limit
to 256.
$result = $client->batch()
->updateMember(5, new UpdateMemberRequest(mobileNumber: '07700 900123'))
->registerGroup(7, new RegisterGroupRequest(groupId: 12, gsrName: 'John D.'))
->registerOfficer(7, new RegisterOfficerRequest(officerId: 3, positionName: 'Chair', officerName: 'Ann B.'))
->send();
if (!$result->success) {
foreach ($result->failures() as $i => $failed) {
echo "Request {$i}: {$failed->errorCode} — {$failed->errorMessage}\n";
}
}$result->responsesholds oneApiResponseper request, in queue order (members come back hydrated asMember).batch(requireAllValid: true)runs nothing unless every request passes the server's validation;$result->validationFailedis then true and only the failing requests carry a response.- A batch holds at most 256 requests (the limit Integrity sets on the site);
queueing a 257th throws
LengthException. PassmaxSize:if the site overrides that limit. - Reads (
GET) can't be batched — WordPress core doesn't allow it.
Authentication is a Bearer token sent via the Authorization header. See
client-example.php for fuller usage across the other endpoints.
MIT © The Bleeding Deacons