gdbots/pbj
gdbots/pbj brings Protocol Buffers to PHP with schema-driven message classes, built-in validation, and serialization to JSON, binary, and protobuf. Define a schema once, generate PHP classes, and move data reliably between services with a consistent, type-safe format.
Architecture fit
gdbots/pbj is a schema-first message library: immutable generated classes, fluent builders, required-field validation, nested/enum/repeated support, and dual binary/JSON serialization. Architecturally it occupies the same layer as DTOs, value objects, and transport contracts — not a replacement for Eloquent models or Laravel's validation layer.gdbots/pbjx, gdbots/ncr, their AMQP/Kafka messaging stack). Pulling pbj alone gives you the message primitives without the surrounding routing, schema registry, or compiler workflow that makes the ecosystem coherent. That is a partial adoption of a tightly-coupled stack.Integration feasibility
google/protobuf, you cannot exchange messages with non-PHP services or standard tooling, which removes most of the strategic justification.Technical risk
google/protobuf is the default answer for PHP protobuf; spatie/laravel-data covers Laravel-native typed DTOs; JSON Schema validators cover contract validation. The library needs a clear differentiator to justify the operational cost.Key questions
google/protobuf (proto3), and can a Go/Java/Python service decode it without Gdbots code?google/protobuf and versus plain JSON?Stack fit
gdbots/pbj's own schema/codec deps) against your locked set before assuming.Migration path
acme/messaging) that owns codegen invocation, a service provider, a Cast or queue-payload serializer, and an exception mapper to Laravel's ValidationException. This isolates the vendor dependency to one seam and makes the eventual fork/swap tractable.schemas/ directory with versioned .proto-style definitions and generated output committed or built in CI — pick one and be strict.Compatibility
app/ (e.g., app/Generated/ excluded from static analysis rules or included with a baseline).Sequencing
protoc-generated client in another language. This single test answers the go/no-go question.Maintenance
Support
Scaling
Failure modes
Ramp-up
google/protobuf alternative has been explicitly compared and rejected on ergonomics.How can I help you explore Laravel packages today?