Skip to content
Shuhei Tanuma edited this page Dec 26, 2013 · 30 revisions

php-protocolbuffers

php-protocolbuffers provides Fast and Robust protocol buffers serializer and deserializer into PHP.

Menu

Supported Platforms

  • Linux like OS
  • Windows

Features

Standard types (numbers, string, enums, messages, etc) supported
Repeated fields supported
Packed attributes supported
Extensions alpha
Unknown fields beta
Service (RPC) not supported yet
64bit values EXPERIMENTAL

PHP specific features

  • __sleep and __wakeup method support.

You can use above magic methods when enabling UseWakeupAndSleep flag. Be careful, this feature is not part of protocolbuffers specification. these method will call when parseFromString and serializeToString (also supports ProtocolBuffers::decode and ProtocolBuffers::encode)

$phpoptions = $descriptor_builder->getOptions()->getExtension(ProtocolBuffers::PHP_MESSAGE_OPTION);
$phpoptions->setUseWakeupAndSleep(true); // default is off
$descriptor = $descriptor_builder->build();