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