create, apply, patch, archive / restore, list, events, get, select, verify) while negotiating Noise + Cap’n Proto frames directly against the control socket. Defaults come from EVENTDBX_* environment variables, so you can drop it into Laravel, Symfony, or plain PHP services.
Feature highlights
- Native control-socket client over Noise XX + Cap’n Proto with parity to other SDKs (
create,apply,patch,archive/restore,list,events,get,select,verify). - Publish targets and per-call token overrides on mutations; payload/metadata/note fields accept any JSON-serializable data.
- Pagination helpers for aggregates and events with
take,cursor, and filtering/sorting by aggregate type. - Defaults for host/port/token/tenant pulled from
EVENTDBX_*; configure timeouts and Noise on/off flags per client. - PHP 8.1+ with the
ffiextension; no PSR HTTP client required because it talks to the control socket directly.
Install
Build the native library before running the client:
cd vendor/eventdbx/eventdbx-php/native
cargo build —release
The client will auto-load native/target/release/libeventdbx_php_native.(so|dylib|dll).
Ensure FFI is allowed for your SAPI (ffi.enable=preload in php.ini, and
add the built library path to ffi.preload if your environment restricts
dynamic loads).Quickstart
Publish targets
plugin with optional mode and priority.
Write aggregates and events
create seeds the aggregate and its first event atomically; apply appends events; patch issues RFC 6902 operations against prior payloads; archive/restore toggle write access while preserving history.
Read aggregates and events
items and nextCursor; pass cursor back to keep paging. Filters and sorts follow the control-plane syntax (e.g., aggregate_type = "person" is added automatically when listing a specific type).
Runtime configuration
| Variable | Default | Description |
|---|---|---|
EVENTDBX_HOST | 127.0.0.1 | Hostname or IP address of the control socket. |
EVENTDBX_PORT | 6363 | TCP port for the control plane. |
EVENTDBX_TOKEN | required | Control token forwarded during the handshake. |
EVENTDBX_TENANT_ID | default | Tenant identifier included in the initial hello. |
EVENTDBX_NO_NOISE | false | Set 1/true to request plaintext transport (server must allow it). |
protocol_version, connect_timeout_ms, request_timeout_ms, tenantId, and noNoise.
Noise transport
Noise is enabled by default with a PSK derived from the control token. Only disable it for controlled testing by passing['noNoise' => true] to the client config or setting EVENTDBX_NO_NOISE=1; production deployments should keep Noise on.
Development & testing
ffi.enable is permitted in your PHP SAPI and restart PHP-FPM after changing php.ini.