Repository navigation
v2.1.0 — NATS 2.11/2.12 client feature support
NATS 2.11 / 2.12 client feature support. A minor, backward-compatible release (new optional parameters and new methods only); the single behavior change is bug-driven. Implements the roadmap milestone (issues #4–#11, #13), hardened by an adversarial multi-agent review.
✨ New features
- Per-message & KV TTL (
Nats-TTL, ADR-43, #4) —publish(..., ttl:),KeyValueBucket::put(..., ttl:), and tombstone TTL ondelete()/purge(). NewMessageTtlformatter (seconds / Go duration /never). - Publish de-duplication (
Nats-Msg-Id, #11) —publish(..., msgId:);publish()also takes a genericheadersarray. - Recurring & cron scheduled publishing (ADR-51, #6) —
@every, 6-field cron, and the predefined aliases (@daily,@hourly, …);@atnow accepts RFC3339 numeric offsets.Schedule::every()/cron()/predefined(); optionalNats-Schedule-Source/-Time-Zone/-Rollupheaders. - Distributed counter CRDT (
AllowMsgCounter/Nats-Incr, ADR-49, #9) —incrementCounter()/counterValue(), arbitrary-precision (string) safe. - Multi-subject consumer filters (
filter_subjects, #10) — validated, mutually exclusive with the singular filter. - Atomic batch publish (
AllowAtomicPublish, ADR-50, #8) —JetStreamContext::batch()→BatchPublisher(Nats-Batch-Id/-Sequence/-Commit; start sent as a request so a rejected batch aborts early; capped at 1000). - Pull priority groups + richer pull options (ADR-42, #7) —
fetchBatch()/fetchNext()pulloptions (group/min_pending/min_ack_pending/priority/max_bytes/no_wait);PullConsumerIteratorsetters withNats-Pin-Idcapture and 423 re-pin; newunpinConsumer()/pinIdOf(). - Batched / multi Direct Get (ADR-31, #13) —
directGetBatch()/directGetLastForSubjects().
🐛 Behavior change (bug-driven)
- Subject delete-markers (
Nats-Marker-Reason, ADR-43, #5) — KVget()/getAll()/watch()and Object Storewatch()/info()now treat a server-written delete-marker as a tombstone instead of surfacing it as a live empty value. Flagged[bugfix](so it does not force a major bump); only reachable when a stream hassubject_delete_marker_ttlset. See the migration note in the CHANGELOG.
✅ Quality
- PHPStan level 8 clean; 490 unit tests passing.
- Adversarially reviewed (9 reviewers + per-finding verification, 32 agents): 17 confirmed findings fixed, including a real ADR-50 batch-start protocol fix and several de-tautologized tests.
⚠️ Pending live verification
Atomic batch publish (#8) and batched Direct Get (#13) are unit-tested at the wire level but not yet verified against a live NATS 2.11/2.12 server.
Full changelog: https://github.com/ideaconnect/php-nats-jetstream-client/blob/main/CHANGELOG.md