protobuf-php/protobuf-plugin
A protoc plugin that generates PHP classes from .proto definitions for the protobuf-php runtime, enabling typed Protocol Buffer message serialization and deserialization in PHP projects.
.proto files as the single source of truth between a PHP app and Go/Java/Python services, we need a PHP code-generation path. This package is one candidate generator, so it informs the "how do PHP consumers get typed classes from the contract?" half of that decision.Consider it only when all of the following hold:
protobuf-php/protobuf pure-PHP runtime (this plugin is a generator for that library, not for Google's google/protobuf runtime), and.proto sources and cannot invoke protoc --php_out directly, andLook elsewhere — and we almost certainly should — when:
protoc with the built-in --php_out generator plus the official google/protobuf runtime, or grpc/grpc for gRPC. First-party, maintained, and covers proto3 optional, JSON mapping, and well-known types that a 2017 generator predates.protoc plugin protocols. Validate before it appears in any estimate.symfony/serializer, spatie/laravel-data, or OpenAPI-generated clients solve the same product problem with far better support and Laravel ecosystem fit.The honest read: this is a reference implementation and fallback, not an adoption candidate. Its value to us is as a reading of how PHP protobuf codegen works and as a possible fork base if a legacy system traps us.
For executives (one paragraph): We evaluated protobuf-php/protobuf-plugin, a code generator that turns Google Protocol Buffers schema files into PHP classes. It is a small, MIT-licensed, single-purpose build-time tool with 57 GitHub stars, no downstream dependents, and no release since January 2017. Our recommendation is do not adopt it as a dependency; instead, if we pursue schema-first contracts between PHP and other services, use Google's official protoc --php_out generator and runtime, which are maintained and already support modern PHP. The strategic decision this unlocks is the protobuf-vs-JSON and gRPC-yes/no call — that decision is worth making this quarter; this package is not worth adopting to make it.
For engineering (the short version): It generates PHP classes for the protobuf-php/protobuf runtime, not for google/protobuf. It predates proto3 optional, well-known-type support, and PHP 8. Zero dependents means no community to absorb breakage. If a legacy service forces us onto it, budget for a fork and pin it; otherwise use the first-party generator. Ask: one-week spike, exit criteria = generates our three representative messages on our current PHP version and passes a round-trip serialization test. If it fails, we close the ticket with a documented "no" and move on to the JSON/vs/protobuf decision on its own merits.
How can I help you explore Laravel packages today?