PHPackages                             haoyanfei/protobuf-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. haoyanfei/protobuf-php

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

haoyanfei/protobuf-php
======================

PHP implementation of Google's Protocol Buffers

1.0(6y ago)07MITPHPPHP &gt;=5.3.0

Since Jul 12Pushed 6y agoCompare

[ Source](https://github.com/haoyanfei/Protobuf-PHP)[ Packagist](https://packagist.org/packages/haoyanfei/protobuf-php)[ Docs](https://github.com/haoyanfei/Protobuf-PHP.git)[ RSS](/packages/haoyanfei-protobuf-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Protobuf for PHP
================

[](#protobuf-for-php)

Protobuf for PHP is an implementation of Google's Protocol Buffers for the PHP language, supporting its binary data serialization and including a `protoc`plugin to generate PHP classes from .proto files.

Great effort has been put into generating PHP files that include all sort of type hints to aide IDE's with autocompletion. Therefore, it can not only be used to communicate with Protocol Buffers services but also as a generation tool for *data objects* no matter what the final serialization is.

For more information see the [included man pages](http://drslump.github.com/Protobuf-PHP/).

Requirements
------------

[](#requirements)

- PHP 5.3
- Pear's Console\_CommandLine (for the protoc wrapper tool)
- Google's `protoc` compiler version 2.3 or above
- GMP or BC Math extensions ¹

¹ Only needed for negative values in `int32`, `int64` or `fixed64` types. See the *known issues* section.

Features
--------

[](#features)

### Working

[](#working)

- Standard types (numbers, string, enums, messages, etc)
- Pluggable serialization backends (codecs)
    - Standard Binary
    - Standard TextFormat ¹
    - PhpArray
    - JSON
    - [ProtoJson](https://github.com/drslump/ProtoJson) (*TagMap* and *Indexed* variants)
    - XML
- Protoc compiler plugin to generate the PHP classes
- Extensions
- Unknown fields
- Packed fields
- Reflection
- Dynamic messages with annotations support
- Generates service interfaces
- Includes comments from .proto files in the generated files
- Pear package for easy installation

¹ Only serialization is supported

### Future

[](#future)

- Speed optimized code generation mode
- Support numbers beyond PHP's native limits

Example usage
-------------

[](#example-usage)

```
