rybakit/msgpack
Pure PHP implementation of the MessagePack serialization format, fully compliant with the latest spec. Supports streaming unpacking, unsigned 64-bit integers, custom object types and extensions, with good performance and full test coverage.
Timestamp (seconds + nanoseconds), custom extension types (e.g., DateTime serialized natively), and streaming unpacking of multiple framed messages from a single socket/chunked read. These unlock features like efficient time-series/vector/embedding storage, binary blob transport, and multiplexed connections.Adopt when:
ext-msgpack — shared hosting, constrained PaaS, locked corporate base images, Lambda layers, or a platform team that won't add extensions. This is the primary reason to choose this library over the C extension.tryUnpack, append, seek, skip, release).unsigned 64-bit handling with a deliberate policy (BIGINT_AS_STR / GMP / Decimal) — a real correctness decision for IDs and counters.Serializer interface, a cache decorator, a queue payload cast) so the decision is reversible.Look elsewhere when:
ext-msgpack is installable. Then use it — a pure PHP codec will not beat a C implementation on CPU, and you should treat this package as the fallback, not the default.json_encode is native and often wins on throughput; benchmark your actual payloads before committing.curl-ability have real operational value.Gating questions for the go/no-go: Have we measured bytes and CPU on a representative payload? Is ext-msgpack genuinely unavailable? Is the format isolated behind one interface? Do we have a rollback (version-tagged payloads or dual-read)?
To executives: This is a small, low-cost, reversible infrastructure choice. We are evaluating the format for internal payloads to cut Redis memory and network egress, and this library is the option that requires zero changes to our hosting, base images, or CI because it's pure PHP — no native extension to get approved or deployed. It's MIT-licensed and implements a public, multi-language standard, so we're not locked in. Decision cost is low and the escape hatch is a one-method interface swap. Ask: approve a short spike to measure bytes saved and CPU cost on real payloads before we commit.
To engineering: Pure-PHP, Composer-installable, PSR-4, no extension dependency. Fully spec-compliant with explicit pack/unpack options (bitmask, with mutual-exclusion validation and clear exceptions), streaming unpacking for chunked input, configurable unsigned-64-bit handling, and a clean extension/transformer model for custom types and Timestamp. Tested and fuzzed. The trade-off is honest: it will lose to ext-msgpack on raw throughput — so the plan is to put it behind a Serializer interface, benchmark against json_encode on our actual payloads, and feature-flag the rollout with a format version in the payload.
To the product team: The user-visible wins are indirect but real — smaller payloads mean faster cache reads at the tail, lower memory pressure at peak, cheaper storage/egress, and the ability to ship binary and nanosecond-timestamp data without base64 workarounds. The risk to manage is dependency concentration: isolate it so we can swap or fork without a rewrite.
How can I help you explore Laravel packages today?