Install
Configure
Two values, and the first is two values in one. The signing credential is a key id and a secret joined by a colon — pasting in the secret alone is the common setup mistake.Wire the client, once
Guard a paid route
The PSR-15 middleware performs the whole sequence in the order that matters, so no route can get it wrong or forget the last step:zc-usage, which is what turns the work into
revenue.
When the cost is not known upfront
Declare a ceiling, then settle the real amount. ZeroClick authorises up to the ceiling and bills what you settle, so a ceiling never overcharges:Free endpoints that still need a caller
zc-usage. See free and identity endpoints.
Three things that cost money quietly
The maintainer documents these prominently, and they are worth repeating because each is a silent failure rather than an error in a log:- The default serves work you may never bill. When the allowance API gives
no usable answer, the package serves the request anyway — matching every
official SDK, so a ZeroClick outage does not become your outage. Watch it with
onAllowanceUnavailable, or chooseOutagePolicy::Denyif refusing costs you less than serving for free. - An unreported ceiling settles at zero.
upTo()authorises up to a limit and charges what you settle. Deliver without settling and that is zero — free for the buyer, unbilled for you, no error anywhere. - A normalised request target fails verification. ZeroClick signs the
percent-encoded path and query exactly as sent. A framework or an ingress that
decodes or reorders them breaks verification for those URLs only, in
production only, as an unexplained
401. The package faults loudly on the framework case; the proxy case is a deployment concern — nginx and several managed load balancers normalise%2Fby default. See the maintainer’s raw request target.
What we verified
We ran our shared signing conformance vectors — the same 29 cases every official SDK is checked against, including malformed-header and tampered-body cases — against this package, and all 29 agreed. That covers signature verification: the part where a mistake means serving forged traffic. Two gaps to plan around, neither a defect:- No stateful account helpers. If you sell accounts and API keys rather than metering per call, implement those two routes yourself against the reference.
- It carries runtime dependencies — PSR HTTP interfaces,
php-http/discovery,psr/clock— where the official SDKs deliberately carry none. They land in yourcomposer.jsonbeside your own.