|
Maxious
|
1 |
protoc-gen-php(1) -- protoc compiler plugin |
|
|
2 |
=========================================== |
|
|
3 |
|
|
|
4 |
## SYNOPSIS |
|
|
5 |
|
|
|
6 |
`protoc-gen-php` [`-v`] [`-o` _directory_] [`-i` _directory_] <file>... |
|
|
7 |
|
|
|
8 |
|
|
|
9 |
## DESCRIPTION |
|
|
10 |
|
|
|
11 |
**protoc-gen-php** is a Google's Protocol Buffers compiler plugin |
|
|
12 |
for the `protoc` tool. It generates PHP classes compatible with |
|
|
13 |
**Protobuf for PHP** from .proto files. |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
## REQUIREMENTS ## |
|
|
17 |
|
|
|
18 |
**protoc-gen-php** is written in PHP using features first found on |
|
|
19 |
PHP 5.3. It also requires the Console_CommandLine package from Pear. |
|
|
20 |
|
|
|
21 |
Additionally you'll also need to have a working copy of Google Protocol |
|
|
22 |
Buffers's _protoc_ command, version 2.3 or above, available on your path. |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
## OPTIONS ## |
|
|
26 |
|
|
|
27 |
The command accepts the following command-line options (switches). |
|
|
28 |
|
|
|
29 |
* `-v`, `--verbose`: |
|
|
30 |
Enables verbose mode. Additional information will be printed when |
|
|
31 |
processing the files. |
|
|
32 |
|
|
|
33 |
* `-h`, `--help`: |
|
|
34 |
Prints the usage help message and quits. |
|
|
35 |
|
|
|
36 |
* `-i` _directory_, `--include`=_directory_: |
|
|
37 |
Tells the protoc compiler to look into that directory when resolving |
|
|
38 |
import statements. Note that you can use this switch more than once |
|
|
39 |
to configure multiple directories. |
|
|
40 |
|
|
|
41 |
* `-o` _directory_, `--out`=_directory_: |
|
|
42 |
Tells the protoc compiler to create generated files in the given |
|
|
43 |
directory. If not set it will create the files in the working |
|
|
44 |
directory. |
|
|
45 |
|
|
|
46 |
* `--protoc`=_path to protoc binary_: |
|
|
47 |
If you don't happen to have the `protoc` binary in your path, you can |
|
|
48 |
use this option to indicate a path to it. |
|
|
49 |
|
|
|
50 |
* `--skip-imported` |
|
|
51 |
Flags the compiler to only generate source code for the proto file |
|
|
52 |
explicitely given on the command line. This means that imported files |
|
|
53 |
will not be generated when using this option. |
|
|
54 |
|
|
|
55 |
* `--comments` |
|
|
56 |
Parses the .proto files looking for multiline comments (/* ... */) to |
|
|
57 |
include them in the generated files. |
|
|
58 |
|
|
|
59 |
* `-Ddefine`, `-Ddefine`=_value_: |
|
|
60 |
Defines an option (defaults to true if no value given) to pass to |
|
|
61 |
the generator. See protobuf-php(5) for supported options, noting that |
|
|
62 |
the `php.` prefix shall not be used here. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
## EXAMPLES ## |
|
|
66 |
|
|
|
67 |
Generate a PHP file from a proto file: |
|
|
68 |
|
|
|
69 |
$ protoc-gen-php tutorial.proto |
|
|
70 |
|
|
|
71 |
Generate PHP files in the "build" directory for each proto file found the |
|
|
72 |
"protos" directory: |
|
|
73 |
|
|
|
74 |
$ protoc-gen-php -o build protos/*.proto |
|
|
75 |
|
|
|
76 |
Generate a PHP file from a proto file using imports from an include path: |
|
|
77 |
|
|
|
78 |
$ protoc-gen-php -i ./protos protos/tutorial.proto |
|
|
79 |
|
|
|
80 |
Generate a PHP file with a custom extension |
|
|
81 |
|
|
|
82 |
$ protoc-gen-php -Dsuffix=pb.php tutorial.proto |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
## BUGS ## |
|
|
86 |
|
|
|
87 |
Please report bugs using GitHub's issue tracker at http://github.com/drslump/protobuf-php/issues |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
## COPYRIGHT ## |
|
|
91 |
|
|
|
92 |
Protobuf for PHP is Copyright (C) 2011 Ivan -DrSlump- Montes <http://pollinimini.net> |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
## SEE ALSO |
|
|
96 |
|
|
|
97 |
protobuf-php(3), protobuf-php(5), |
|
|
98 |
<http://github.com/drslump/protobuf-php> |
|
|
99 |
|