sendproof / core
Framework-neutral Sendproof protocol core for PHP: preview, observed send, capture and embedded workbench assets.
Requires
- php: ^8.2
- ext-json: *
- ext-mbstring: *
Requires (Dev)
None
Suggests
- aws/aws-sdk-php: Write guard for DynamoDB clients
- elasticsearch/elasticsearch: Write guard for Elasticsearch 8 and 9 clients
- google/cloud-firestore: Write guard for Firestore clients (needs ext-grpc)
- mongodb/mongodb: Guarded MongoDB client and Preview transactions (needs ext-mongodb)
- opensearch-project/opensearch-php: Write guard for OpenSearch 2 clients (PSR-18 and legacy transports)
- predis/predis: Write guard for Predis Redis clients
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-22 23:00:10 UTC
README
Framework-neutral PHP core of Sendproof protocol v1. A framework integration such as sendproof/laravel supplies request dispatch and a database provider; this package supplies everything else.
| Area | Classes |
|---|---|
| Protocol rules | Protocol (Prefer parsing, same-origin check, preview target validation), Capabilities |
| Preview | PreviewRunner runs one operation in a rollback-only session and builds the confirmed envelope; ObservedRunner stores a trace for an ordinary send |
| Capture | Recorder (logs, effects, SQL, timing), SqlRedactor, Limits |
| Data layer contract | PreviewProvider, PreviewSession, PreviewObservation |
| Traces | TraceStore, FileTraceStore (TTL, per-owner and total caps), TraceOwner |
| Workbench UI | UiBundle reads the embedded bundle and verifies each file's SHA-256 against manifest.json |
Embedded UI
The workbench UI is not copied into this repository's PHP sources. resources/ui is generated output of the shared packer and must be refreshed before a release:
composer embed-ui # node tools/pack-ui.mjs --version 0.1.0-alpha.1 --out resources/ui
UiBundle serves only files listed in manifest.json and refuses any file whose hash does not match.
Writing another framework adapter
- Rewrite
/sendproof/_preview/<target>to<target>and dispatch it through the framework's normal pipeline in the same process. CheckProtocol::hasExactPreference,Protocol::isValidTargetandProtocol::isSameOriginfirst. - Confirm the target was opted in before dispatching, so unmarked handlers never run.
- Wrap the dispatch in
PreviewRunner::run. MarkPreviewState::reachedandcompletedfrom a marker that runs immediately around the handler, after authentication. - Convert the inner response to a
CapturedResponse, including any unhandled error the framework turned into a response. - For Observed Send, use
ObservedRunnerwith aTraceStoreand an owner key fromTraceOwner::key.
Implement PreviewProvider for your data layer: begin on the connection the handler uses, return a session that reports changes and verifies rollback, and release everything on every failure path.
Tests
composer install && vendor/bin/phpunit
Data stores
Sendproof\Core\Stores holds the write guard, the classifiers and the hooks for Predis, the AWS SDK and the MongoDB library. PreviewRunner::run() takes the hooked stores as its last argument. See data stores in the PHP binding.