PHPackages                             eliep/avro-rpc-php-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. eliep/avro-rpc-php-generator

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

eliep/avro-rpc-php-generator
============================

This library generates an Avro RPC client based on eliep/avro-rpc-php

1.7.7-p2(9y ago)6266Apache-2.0PHP

Since Aug 20Pushed 9y ago3 watchersCompare

[ Source](https://github.com/eliep/avro-rpc-php-generator)[ Packagist](https://packagist.org/packages/eliep/avro-rpc-php-generator)[ Docs](https://github.com/eliep/avro-rpc-php-generator)[ RSS](/packages/eliep-avro-rpc-php-generator/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Avro RPC Generator
==================

[](#avro-rpc-generator)

See [Avro](http://avro.apache.org/) for a full documentation on Avro and its usage in PHP.

This library use [avro-rpc-php](https://github.com/eliep/avro-rpc-php) as an implementation of the Avro RPC protocol in php.

Installation
------------

[](#installation)

```
composer require eliep/avro-rpc-php-generator
```

Protocol class Generation
-------------------------

[](#protocol-class-generation)

The script is located in your vendor/bin folder:

```
php vendor/bin/generate.php --help
```

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
-----------

[](#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
--------------------

[](#protocol-class-usage)

For example, if your protocol is:

```
{
 "namespace": "my.avro",
 "protocol": "Protocol",

 "types": [
     {"type": "record", "name": "SimpleRequest",
      "fields": [{"name": "subject",   "type": "string"}]
     },
     {"type": "record", "name": "SimpleResponse",
      "fields": [{"name": "something",   "type": "string"}]
     }
 ],

 "messages": {
    "requestSomething": {
      "request": [{"name": "message", "type": "SimpleRequest"}],
      "response": "SimpleResponse"
    }
  }
}
```

you can connect to an Avro RPC Server with

```
use My\Avro\ProtocolRequestor

$serverHost = '127.0.0.1';
$serverPort = 1412;
try {
  $requestor = new ProtocolRequestor($serverHost, $serverPort);
} catch (\Exception $e) {
    // unable to reach the server.
}
```

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:

```
$response = $requestor->requestSomething(array("subject" => "ping"));
```

Example
-------

[](#example)

An example is available in example/ folder.

- Start a server

```
php bin/generate.php sample_rpc_server.php
```

- Use the sample client

```
php bin/generate.php sample_rpc_client.php
```

- Regenerate the sample client

```
php bin/generate.php --input example/avro/ --output example/ --prefix Example --stringType
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3600d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6548339?v=4)[Elie](/maintainers/eliep)[@eliep](https://github.com/eliep)

---

Top Contributors

[![eliep](https://avatars.githubusercontent.com/u/6548339?v=4)](https://github.com/eliep "eliep (1 commits)")

---

Tags

rpcserializationavro

### Embed Badge

![Health badge](/badges/eliep-avro-rpc-php-generator/health.svg)

```
[![Health](https://phpackages.com/badges/eliep-avro-rpc-php-generator/health.svg)](https://phpackages.com/packages/eliep-avro-rpc-php-generator)
```

###  Alternatives

[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k233.3M315](/packages/opis-closure)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k139.8M905](/packages/jms-serializer)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k91.4M664](/packages/jms-serializer-bundle)[google/flatbuffers

FlatBuffers for PHP

26.1k144.0k5](/packages/google-flatbuffers)[apache/avro

Apache Avro™ is a data serialization system.

3.3k50.6k3](/packages/apache-avro)[flix-tech/avro-serde-php

A library to serialize and deserialize Avro records making use of the confluent schema registry

674.1M19](/packages/flix-tech-avro-serde-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
