1. Go to this page and download the library: Download eliep/avro-rpc-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eliep / avro-rpc-php example snippets
/**
* $protocol: your Avro protocol as a string
* $serverHost: Avro RPC Server Host
* $serverPort: Avro RPC Server Port
**/
// Parse your avro protocol
$avroProtocol = AvroProtocol::parse($protocol);
// Connect to the server
$client = NettyFramedSocketTransceiver::create($serverHost, $serverPort);
// Retrieve a client
$requestor = new Requestor($avroProtocol, $client);
try {
$response = $requestor->request('testSimpleRequestResponse', array("message" => array("subject" => "pong")));
echo "Response received: ".json_encode($response)."\n";
} catch (AvroRemoteException $e) {
// an error occured on the server while handling the request.
}
bash
composer
shell
phpunit test/AllTests.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.