PHPackages                             rv/tproto - 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. rv/tproto

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

rv/tproto
=========

Stream transfer/receive objects over HTTP

v0.1(8y ago)212MITPHPPHP &gt;=5.4.0

Since Mar 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/vasilevrv/tproto)[ Packagist](https://packagist.org/packages/rv/tproto)[ RSS](/packages/rv-tproto/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

tproto
======

[](#tproto)

### How to use.

[](#how-to-use)

Create Transmitter. For example, use transmitter with unbuffered PDO query and symfony:

```
return new \Symfony\Component\HttpFoundation\StreamedResponse(function() use ($pdo) {
    $tm = new \RV\TProto\Proto\Transmitter\Transmitter(function($data) {
        echo $data;
    }, null, true);

    $pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
    $res = $pdo->query("SELECT id, status FROM tblclients");
    while (false !== ($row = $res->fetch(\PDO::FETCH_ASSOC))) {
        $tm->send($row);
    }
});
```

Create receiver. For example (now there is only guzzle adapter, you can use your own adapters):

```
$stream = $client->get('https://test.com/stream')->getBody();
$update = new \RV\TProto\Proto\Receiver\Receiver($stream, function($data) {
    print_r($data);
});
$update->run();
```

If you need to receive objects not one at a time, but a batch, then you can use BatchReceiver (200 in batch, for example):

```
$stream = $client->get('https://test.com/stream')->getBody();
$update = new \RV\TProto\Proto\Receiver\BatchReceiver($stream, function($data) {
    print count($data);
}, null, 200);
$update->run();
```

---

Also, you can use customize serializer and DTO:

```
class Client
{
    public $id;
    public $status;

    public function __construct($id, $status)
    {
        $this->id = $id;
        $this->status = $status;
    }
}
```

```
class CustomSerializer implements \RV\TProto\Serializer\SerializerInterface
{
    public function serialize($data)
    {
        return $data['id'].";".$data['status'];
    }

    public function deserialize($data)
    {
        return new Client($data['id'], $data['status']);
    }

    public function getDelimiter()
    {
        return ":";
    }
}
```

And use it on transmitter and receiver, for example receiver:

```
$update = new \RV\TProto\Proto\Receiver\Receiver($stream, function($data) {
    var_dump($data);
}, new CustomSerializer());
```

It print object:

```
object(Client)#1 (2) {
  ["id"]=>
  int(123)
  ["status"]=>
  int(0)
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

2

Last Release

2969d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d228d2d66073c172aaa2470c933870451f7d56b576dc259e20ddef69c854a6f?d=identicon)[vasilevrv](/maintainers/vasilevrv)

---

Tags

bufferjsonobjectphptransferjsonBuffertransfer

### Embed Badge

![Health badge](/badges/rv-tproto/health.svg)

```
[![Health](https://phpackages.com/badges/rv-tproto/health.svg)](https://phpackages.com/packages/rv-tproto)
```

###  Alternatives

[justinrainbow/json-schema

A library to validate a json schema.

3.6k316.9M606](/packages/justinrainbow-json-schema)[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[jms/serializer

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

2.3k135.8M848](/packages/jms-serializer)[jms/serializer-bundle

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

1.8k89.3M618](/packages/jms-serializer-bundle)[colinodell/json5

UTF-8 compatible JSON5 parser for PHP

30422.2M45](/packages/colinodell-json5)[clue/ndjson-react

Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.

15267.7M16](/packages/clue-ndjson-react)

PHPackages © 2026

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