Search by

Framework-neutral Sendproof protocol core for PHP: preview, observed send, capture and embedded workbench assets.

Package info

github.com/mprync/sendproof-php-core

Homepage

Issues

Language:JavaScript

pkg:composer/sendproof/core

Statistics

Installs: 1

Dependents: 2

Suggesters: 0

Stars: 0

v0.1.0-alpha.1 2026-11-22 19:39 UTC

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

  1. Rewrite /sendproof/_preview/<target> to <target> and dispatch it through the framework's normal pipeline in the same process. Check Protocol::hasExactPreference, Protocol::isValidTarget and Protocol::isSameOrigin first.
  2. Confirm the target was opted in before dispatching, so unmarked handlers never run.
  3. Wrap the dispatch in PreviewRunner::run. Mark PreviewState::reached and completed from a marker that runs immediately around the handler, after authentication.
  4. Convert the inner response to a CapturedResponse, including any unhandled error the framework turned into a response.
  5. For Observed Send, use ObservedRunner with a TraceStore and an owner key from TraceOwner::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.