Download the PHP package hivellm/synap-sdk without Composer
On this page you can find all versions of the php package hivellm/synap-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hivellm/synap-sdk
More information about hivellm/synap-sdk
Files in hivellm/synap-sdk
Package synap-sdk
Short Description PHP SDK for Synap - High-Performance In-Memory Key-Value Store & Message Broker
License Apache-2.0
Informations about the package synap-sdk
Synap PHP SDK
Official PHP client library for Synap - High-Performance In-Memory Key-Value Store & Message Broker.
Features
- 💾 Key-Value Store: Fast in-memory KV operations with TTL support
- 📨 Message Queues: RabbitMQ-style queues with ACK/NACK
- 📡 Event Streams: Kafka-style event streams with offset tracking
- 🔔 Pub/Sub: Topic-based messaging with wildcards
- ⚡ StreamableHTTP Protocol: Unified endpoint for all operations
- 🛡️ Type-Safe: Leverages PHP 8.2+ type system for correctness
- 📦 PSR-4: Standard autoloading and best practices
Requirements
- PHP 8.2 or higher
- Composer
- Synap Server running
Installation
Quick Start
Transports
Since v0.11.0 the SDK selects the transport via URL scheme — no separate builder methods required:
| URL scheme | Default port | When to use |
|---|---|---|
synap:// |
15501 |
✅ Recommended default — MessagePack over persistent TCP, lowest latency. |
resp3:// |
6379 |
Redis-compatible text protocol — interop with existing Redis tooling. |
http:// / https:// |
15500 |
Original REST transport — full command coverage. |
All commands (KV, Hash, List, Set, Sorted Set, Queue, Stream, Pub/Sub, Transactions, Scripts, Geo, HyperLogLog) are fully supported on every transport. Native transports throw UnsupportedCommandException instead of silently falling back to HTTP.
The synap:// transport is Thunder
The binary transport is not hand-written in this SDK. It is
Thunder (hivellm/thunder) — the HiveLLM
family's shared binary RPC client, the same protocol the Synap server runs on,
so the two ends of the wire cannot drift.
| Frame cap | 512 MiB, validated against the length prefix before allocating. |
| Authentication | withAuthToken / withBasicAuth credentials travel in the handshake. The previous transport never sent AUTH, so it could not reach a require_auth server on 15501 at all. |
| Binary values | A value that is not valid UTF-8 survives byte-exact: such strings travel as MessagePack bin. Sent as str, the server rejected the frame and closed the connection. |
| Push | subscribePush receives server-push frames. The previous implementation sent SUBSCRIBE with id = 0xFFFFFFFF, the reserved push sentinel, which the server refuses outright — pub/sub over SynapRPC could not work at all. |
Thunder's PHP client is synchronous and exposes no public poll, so a push
subscription keeps the reader running by issuing a cheap PING and collecting
it; push frames that arrived meanwhile are dispatched during that read. A public
poll is requested upstream in
thunder#11.
Queue, stream and pub/sub over synap://:
API Reference
Configuration
Key-Value Store
KV Watch
Observe a key — or a wildcard pattern — and receive its new value on every
change. Requires the synap:// transport; the loop blocks the current process
(same model as pubsub()->observe()) and issues KV.UNWATCH on the way out:
Delivery is best-effort, latest-value; WatchEvent::$version resets when the
key is deleted, expires or is evicted — version 1 marks a new incarnation.
Message Queues
Event Streams
Pub/Sub
Error Handling
Examples
See the examples/ directory:
basic.php- All features demo
Run examples:
Testing
StreamableHTTP Protocol
This SDK uses the StreamableHTTP protocol with a unified endpoint (/api/stream):
License
Apache License 2.0 - See LICENSE for details.
Links
- Synap Server
- Documentation
- Rust SDK
- TypeScript SDK
- Python SDK
All versions of synap-sdk with dependencies
ext-json Version *
ext-sockets Version *
guzzlehttp/guzzle Version ^7.8
hivellm/thunder Version ^0.2.1
rybakit/msgpack Version ^0.9