PHPackages                             dkkoma/php-grpc-lite - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. dkkoma/php-grpc-lite

ActivePhp-ext[HTTP &amp; Networking](/categories/http)

dkkoma/php-grpc-lite
====================

Source-built grpc extension for PHP: php-grpc-lite HTTP/2 transport drop-in candidate for ext-grpc

0.0.15(1mo ago)134[1 PRs](https://github.com/dkkoma/php-grpc-lite/pulls)MITCPHP &gt;=8.4CI passing

Since May 8Pushed 1w ago1 watchersCompare

[ Source](https://github.com/dkkoma/php-grpc-lite)[ Packagist](https://packagist.org/packages/dkkoma/php-grpc-lite)[ Docs](https://github.com/dkkoma/php-grpc-lite)[ RSS](/packages/dkkoma-php-grpc-lite/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (8)Versions (57)Used By (0)

php-grpc-lite
=============

[](#php-grpc-lite)

[![Native QA](https://github.com/dkkoma/php-grpc-lite/actions/workflows/native-qa.yml/badge.svg)](https://github.com/dkkoma/php-grpc-lite/actions/workflows/native-qa.yml)[![codecov](https://camo.githubusercontent.com/ec78f43b4e571224b9097659ff525aa85a57815366bac5a706e3d0bc5f3060ab/68747470733a2f2f636f6465636f762e696f2f67682f646b6b6f6d612f7068702d677270632d6c6974652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/dkkoma/php-grpc-lite)

`php-grpc-lite` is a source-built PHP extension aiming to be a drop-in replacement for official `ext-grpc` in selected client workloads.

Current review status:

- High-level PHP `Grpc\*` wrapper classes are provided by the official `grpc/grpc` Composer package.
- HTTP/2 transport is provided by this repository's source-build extension at the repository root.
- The source-built grpc extension builds a PHP module named `grpc` and produces `grpc.so`.
- Official `ext-grpc` and this source-built grpc extension must not be loaded at the same time.
- Runtime transport is the built-in nghttp2 HTTP/2 implementation.
- Release readiness is still gated by C extension memory/lifecycle QA.
- Unary and server streaming are the current compatibility scope. Client streaming and bidirectional streaming are not implemented yet.

Performance snapshot
--------------------

[](#performance-snapshot)

Latest representative local benchmarks: 2026-05-14 for Spanner RPC shape, 2026-05-05 / 2026-05-06 for broader unary and streaming payload sweeps. Environment: Docker compose on OrbStack, Go gRPC test server, `php-grpc-lite` HTTP/2 transport vs official `ext-grpc`. These numbers are workload guidance, not a portability guarantee; rerun the benchmark suite on release hardware for final decisions. Full data: `docs/benchmarks/spanner-shape-2026-05-14.md`, `docs/benchmarks/spanner-real-client-2026-05-14.md`, `docs/benchmarks/native-major-2026-05-05.md`, and `docs/benchmarks/native-hardening-2026-05-06.md`.

casephp-grpc-lite p50php-grpc-lite p99ext-grpc p50ext-grpc p99resultunary 100B28.1μs67.8μs56.6μs103.6μsphp-grpc-lite fasterunary 100KiB77.9μs2,243.1μs106.7μs1,491.2μsp50 faster; p99 slowerSpanner shape: BeginTransaction unary31.6μs128.6μs59.2μs393.4μsphp-grpc-lite fasterSpanner shape: Commit unary28.2μs83.4μs54.9μs107.0μsphp-grpc-lite fasterSpanner shape: SELECT streaming28.9μs70.9μs62.3μs115.6μsphp-grpc-lite fasterSpanner shape: DML insert streaming26.1μs69.0μs68.1μs110.4μsphp-grpc-lite fasterSpanner shape: DML update streaming26.1μs72.5μs68.5μs110.3μsphp-grpc-lite fasterSpanner shape: DML delete streaming27.3μs65.4μs71.1μs128.9μsphp-grpc-lite fasterserver streaming 100x100B135.8μs538.8μs334.1μs796.8μsphp-grpc-lite fasterserver streaming 100x10KiB1,111.2μs2,255.9μs1,452.6μs1,974.3μsp50 faster; p99 slower`spanner-shape` is the primary Spanner-oriented performance signal because it keeps the RPC shape close to Spanner while avoiding emulator and GAX noise. `spanner-real-client` is kept as a high-level `google/cloud-spanner` smoke/regression benchmark rather than a transport microbenchmark.

Large bulk streaming remains the main case that should be measured against the actual workload before choosing this extension.

Install
-------

[](#install)

Install build dependencies first. Debian/Ubuntu example:

```
sudo apt-get install -y php-dev build-essential libnghttp2-dev libssl-dev unzip
```

Install the extension with PIE:

```
pie install dkkoma/php-grpc-lite --auto-install-build-tools --auto-install-system-dependencies
```

Then enable `extension=grpc` if PIE did not enable it automatically.

PIE uses Composer's default package download path. For this package, Composer prefers the Packagist/GitHub dist zip for the stable release. Ensure a zip extractor is available: `unzip` is the recommended Debian/Ubuntu package; PHP `ext-zip` or `7z` can also satisfy Composer. Without any zip extractor, Composer falls back to source download and may require `git`.

Applications that use generated stubs or gax clients should also install the official PHP wrapper dependency with Composer:

```
composer require grpc/grpc
```

For local source builds without PIE:

```
git clone  php-grpc-lite
cd php-grpc-lite
phpize
./configure --enable-grpc
make -j"$(nproc)"
sudo make install
```

Full install notes, verification commands, rollback notes, and large-streaming guidance are in `docs/guides/install-native-extension.md`. The documentation entrypoint is `docs/README.md`.

Development
-----------

[](#development)

Run tests in Docker:

```
composer install
./tools/test/check-c-static-analysis.sh
./tools/test/check-c-unit.sh
./tools/test/check-phpt.sh
./tools/test/check-crash-ub.sh
./tools/test/check-c-coverage.sh
docker compose run --rm dev php -d extension=/workspace/modules/grpc.so vendor/bin/phpunit -c tests/phpunit.xml.dist
```

`check-c-static-analysis.sh` runs the C extension static analysis. `check-c-unit.sh` runs focused C unit tests for pure protocol helpers and status taxonomy. `check-phpt.sh` builds the root extension, verifies the local Go test-server ports, and runs PHPT tests for the extension surface, transport control semantics, TLS/mTLS, and resource limits. `check-crash-ub.sh` runs generated-input checks under ASan/UBSan to detect crashes and undefined behavior. `check-c-coverage.sh` runs the C unit and PHPT gates with gcov/lcov instrumentation and writes reports under `var/coverage/c-lcov/`. PHPUnit remains the broader integration/release compatibility suite.

GitHub Actions `Native QA` runs purpose-specific jobs on push and pull request: `Static analysis`, `NTS PHPT + C coverage`, `ZTS PHPT`, and `Crash/UB check`. Coverage is uploaded as a workflow artifact and to Codecov from `var/coverage/c-lcov/codecov.info`; configure `CODECOV_TOKEN` unless the Codecov repository setting allows tokenless public uploads.

Build/load the source-built grpc extension in Docker:

```
docker compose run --rm dev sh -lc 'phpize && ./configure --enable-grpc && make -j$(nproc)'
docker compose run --rm dev php -d extension=/workspace/modules/grpc.so -r 'var_dump(extension_loaded("grpc"), defined("Grpc\\VERSION") && constant("Grpc\\VERSION") === "0.0.15");'
```

Verify source install on the official Docker Hub `php` image:

```
docker build -f docker/Dockerfile.install-grpc -t php-grpc-lite-install-grpc .
docker run --rm php-grpc-lite-install-grpc php -m | grep -x grpc
docker run --rm php-grpc-lite-install-grpc php -r 'var_dump(extension_loaded("grpc"), defined("Grpc\\VERSION") && constant("Grpc\\VERSION") === "0.0.15");'
```

Verify PIE install on the official Docker Hub `php` image:

```
docker build -f docker/Dockerfile.install-pie -t php-grpc-lite-install-pie .
docker run --rm php-grpc-lite-install-pie php -m | grep -x grpc
docker run --rm php-grpc-lite-install-pie php -r 'var_dump(extension_loaded("grpc"), defined("Grpc\\VERSION") && constant("Grpc\\VERSION") === "0.0.15");'
```

To verify a specific released package from Packagist:

```
docker build -f docker/Dockerfile.install-pie \
  --build-arg PHP_GRPC_LITE_PACKAGE=dkkoma/php-grpc-lite:0.0.15 \
  -t php-grpc-lite-install-pie-0.0.15 .
```

Design and QA status:

- `docs/README.md`
- `docs/SPEC.md`
- `docs/design/http2-transport-decision.md`
- `docs/verification/release-qa-checklist.md`

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance96

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~3 days

Total

15

Last Release

36d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/50fd1c8f2e0eb6bebca73c1fe10a405d7dd753fe4b3fe526f97520ce9baa5feb?d=identicon)[dkkoma3](/maintainers/dkkoma3)

---

Top Contributors

[![dkkoma](https://avatars.githubusercontent.com/u/1209568?v=4)](https://github.com/dkkoma "dkkoma (617 commits)")

---

Tags

http2gRPCphp-extensionpie

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dkkoma-php-grpc-lite/health.svg)

```
[![Health](https://phpackages.com/badges/dkkoma-php-grpc-lite/health.svg)](https://phpackages.com/packages/dkkoma-php-grpc-lite)
```

###  Alternatives

[symfony/web-link

Manages links between resources

1.4k106.9M371](/packages/symfony-web-link)[spiral/roadrunner-laravel

Laravel integration for RoadRunner with support for HTTP, Jobs, gRPC, and Temporal plugins - going beyond Octane's capabilities

503332.0k3](/packages/spiral-roadrunner-laravel)[swoole/grpc

Grpc PHP Client base on Swoole Http2 Coroutine

19820.0k1](/packages/swoole-grpc)[roadrunner-php/laravel-bridge

Laravel integration for RoadRunner with support for HTTP, Jobs, gRPC, and Temporal plugins - going beyond Octane's capabilities

50361.7k1](/packages/roadrunner-php-laravel-bridge)[swoole/etcd-client

Grpc PHP Client base on Swoole Http2 Coroutine

1973.3k1](/packages/swoole-etcd-client)[openswoole/core

Openswoole core library

191.3M66](/packages/openswoole-core)

PHPackages © 2026

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