Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A PHP Protocol Buffer Generator Plugin for protoc

branch: master
README.md

PHP Protocol Buffers

This is a PHP Google Protocol Buffer Generator Plugin for protoc. It generates PHP sourcecode from a .proto file. It's not finished, but supports most common features, and is currently in use in production systems.

Installation

  1. Download and install the Protocol Buffer source from http://code.google.com/p/protobuf/downloads/list
  2. Build and install the Protocol Buffer source (see instructions in source)
  3. Download this repo.
  4. cd to this repo's source and type "make".

** NOTE,

System specifics

On Debian you may need the install a few libraries with apt apt:

apt-get install libprotobuf-dev libprotobuf-lite6 libprotobuf6 libprotoc-dev libprotoc6

Usage

Once compiled you can use it via protoc like so:

protoc -I. -I/usr/include --php_out . --plugin=protoc-gen-php=./protoc-gen-php your.proto

This will generate the file "YourProto.php", which will encode and decode protocol buffer messages. When using the generated PHP code you must include the "protocolbuffers.inc.php" file.

TODO's

  • Better documentation
  • Better exception handling
  • Some kind of inheritance model to reduce generated PHP code
  • option (php_multiple_files) support.
  • option (php_package) support
  • make install to a bash wrapper so that we can do something like protocphp your.proto

Authors

Something went wrong with that request. Please try again.