Download the PHP package eliep/avro-rpc-php-generator without Composer
On this page you can find all versions of the php package eliep/avro-rpc-php-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eliep/avro-rpc-php-generator
More information about eliep/avro-rpc-php-generator
Files in eliep/avro-rpc-php-generator
Package avro-rpc-php-generator
Short Description This library generates an Avro RPC client based on eliep/avro-rpc-php
License Apache-2.0
Homepage https://github.com/eliep/avro-rpc-php-generator
Informations about the package avro-rpc-php-generator
Avro RPC Generator
See Avro for a full documentation on Avro and its usage in PHP.
This library use avro-rpc-php as an implementation of the Avro RPC protocol in php.
Installation
Protocol class Generation
The script is located in your vendor/bin folder:
Required arguments:
- --input (-i) dir : The folder containing your Avro protocol
- --output (-o) dir : The folder where the protocol classes will be written
Optional argument:
- --prefix (-p) namespace: The namespace prefix of the output directory
- --stringType (-s) : If the requestor will be used with a java implementation using String instead of CharSequence
- --apcu (-a) : use APCu to cache the parsed protocol.
Namespacing
The generate script will respect the namespace defined in your avro protocol. For example, if you have define "my.avro" as your protocol namespace, the script:
- create the folder
My\Avro
in the directory specified by the -o option. - use
My\Avro
for the generated php class.
Note: If the directory specified by the -o option has a namespace, you can use the option -p to specify it so that the namespace of the generated php class will use it.
The name of the generate class will be protocol name with the Requestor
suffix
(if your protocol's name is Protocol
, the class name will be ProtocolRequestor
);
Protocol class Usage
For example, if your protocol is:
you can connect to an Avro RPC Server with
The ProtocolRequestor
set a temporary error handler to detect if the socket connection
worked. If not, the constructor throw a php Exception.
The ProtocolRequestor
class contains one function for each message in your protocol.
These functions accept as many argument as defined by the corresponding message.
You can call:
Example
An example is available in example/ folder.
-
Start a server
-
Use the sample client
- Regenerate the sample client
All versions of avro-rpc-php-generator with dependencies
docopt/docopt Version 1.0.*
gossi/php-code-generator Version ^0.3.2