PHPackages                             nowgoo/php-protobuf - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nowgoo/php-protobuf

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nowgoo/php-protobuf
===================

simple protobuf encoder and decoder

15551PHP

Since Dec 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/nowgoo/php-protobuf)[ Packagist](https://packagist.org/packages/nowgoo/php-protobuf)[ RSS](/packages/nowgoo-php-protobuf/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

php-protobuf
============

[](#php-protobuf)

simple protobuf encoder and decoder

features
========

[](#features)

- no need to compile .proto files
- decode &amp; encode without a scheme definition
- grpc client \[wip\]

install
=======

[](#install)

```
composer require nowgoo/php-protobuf dev-master

```

usage
=====

[](#usage)

say we have a .proto defined as:

```
message Example {
    int32 foo = 1;
    SubMessage bar = 2;
    repeated baz = 3;
}

message SubMessage {
    string bar_sub = 1;
}

```

code talks:

```
use \PhpProtobuf\Scheme;
$scheme = new Scheme([
    // simple field
    1 => ['name'=>'foo', 'type'=>Scheme::TYPE_INT],
    // embeded field
    2 => ['name'=>'bar', 'type'=>Scheme::TYPE_EMBEDED, 'fields'=>[
        1 => ['name'=>'bar_sub', 'type'=>Scheme::TYPE_STRING]
    ]],
    // repeated field
    3 => ['name'=>'baz', 'type'=>Scheme::TYPE_INT, 'repeated'=>true],
]);

$binary = $scheme->encode([
    'foo' => 123456,
    'bar' => ['bar_sub' => 'hello, world'],
    'baz' => [3, 270, 86942]
]);
// binary = [08 c0 c4 07 12 0e 0a 0c 68 65 6c 6c 6f 2c 20 77 6f 72 6c 64 1a 06 03 8e 02 9e a7 05]

$decoded = $scheme->decode($binary);
// $decoded == ['foo'=>123456, 'bar'=>['bar_sub'=>'hello, world'], 'baz'=>[3,270,86942]];
```

decode/encode without a scheme definition
-----------------------------------------

[](#decodeencode-without-a-scheme-definition)

```
$scheme = new UniversalScheme();
$binary = $scheme->encode([
    'keys' => 123456,
    'were' => 'hello',
    'skipped' => [
        'during' => [
            'encoding' => 'level 3 value'
        ],
        'process' => 'level 2 value',
    ],
]);

$decoded = $scheme->decode($binary);
/*
$decoded:
[
    1 => 123456,
    2 => 'hello',
    3 => [
        1 => [
            1 => 'level 3 value'
        ],
        2 => 'level 2 value',
    ],
]
*/
```

grpc
----

[](#grpc)

\[wip\]

licence
=======

[](#licence)

MIT License

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

grpcphpprotobuf

### Embed Badge

![Health badge](/badges/nowgoo-php-protobuf/health.svg)

```
[![Health](https://phpackages.com/badges/nowgoo-php-protobuf/health.svg)](https://phpackages.com/packages/nowgoo-php-protobuf)
```

###  Alternatives

[jcc/laravel-vote

The package helps you to add user based vote system to your model

13650.9k1](/packages/jcc-laravel-vote)

PHPackages © 2026

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