diff --git a/README.md b/README.md index d247df3..bcb8661 100644 --- a/README.md +++ b/README.md @@ -25,27 +25,25 @@ Use Once compiled and installed you can use it via protoc like so: -``` -protoc --php_out=. your.proto -``` + protoc --php_out=. your.proto This should generate the file "your.proto.php", which should be able to encode and decode protocol buffer messages. When using the generated PHP code you must include the "protocolbuffers.inc.php" file. Notes on Numbers ------ +---------------- PHP uses signed integers, and depending on the platform may be 32 bit or 64 bit in size. Additionally PHP is typically compiled with IEEE 754 double precision floating point numbers, but may be compiled with single precision. This causes multiple problems for PHP using large numbers. As such the best appropimation is used when an exact representation is not available. On 32 bit platforms, signed integers are correct between -2^31 and 2^31-1, outside of that range floats are used. Double precision floats maintain integer accurancy up to 2^53, beyond that integers may not be precisce. -| Proto type | PHP type (32 bit) | PHP type (64 bit) -| -------------------------------------------------------------------------------------- -| bool | bool | bool -| float / double | float | float -| int32 | int | int -| int64 / uint32 | int (between -2^31 and 2^31-1) otherwise float | int -| uint64 | int (between 0 and 2^31-1) otherwise float | int (between 0 and 2^63-1) otherwise float -| byte / string | string | string -| enum | int | int +| Proto type | PHP type (32 bit) | PHP type (64 bit) | +| ---------------- | ---------------------------------------------- | ------------------------------------------ | +| bool | bool | bool | +| float / double | float | float | +| int32 | int | int | +| int64 / uint32 | int (between -2^31 and 2^31-1) otherwise float | int | +| uint64 | int (between 0 and 2^31-1) otherwise float | int (between 0 and 2^63-1) otherwise float | +| byte / string | string | string | +| enum | int | int | @@ -54,21 +52,18 @@ Install This has only been tested on Linux and Mac. You will need the following libraries: -``` -# For Debian based Linux -sudo apt-get install libprotobuf-dev protobuf-compiler + # For Debian based Linux + sudo apt-get install libprotobuf-dev protobuf-compiler -# For Mac -brew install protobuf -``` + # For Mac + brew install protobuf To build: -``` -./autogen.sh -./configure -make -sudo make install -``` + + ./autogen.sh + ./configure + make + sudo make install Licence (Simplified BSD License)