revund/php-worker

Revund's PHP AST sidecar — implements the universal revund.worker.v1.Worker gRPC contract using nikic/PHP-Parser.

Maintainers

Package info

github.com/revund-dev/php-worker

Homepage

pkg:composer/revund/php-worker

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.2 2026-05-21 16:42 UTC

This package is auto-updated.

Last update: 2026-05-21 16:43:55 UTC


README

The PHP AST sidecar for Revund. A gRPC server that implements revund.worker.v1.Worker — the universal contract every Revund worker speaks. Built on nikic/PHP-Parser.

Install

composer global require revund/php-worker

You also need the grpc PECL extension and the revund CLI itself. The CLI discovers revund-php-worker on PATH and spawns it on demand.

pecl install grpc            # one-time, builds the PHP gRPC extension

Usage

The worker is normally launched by the Revund CLI. To run it standalone (for debugging or to share a single instance across reviews):

revund-php-worker                              # binds 0.0.0.0:50052
REVUND_PHP_WORKER_PORT=0 revund-php-worker     # OS-assigned port; prints "ready: 0.0.0.0:<port>" on stdout

Point the CLI at it via the REVUND_WORKERS env var (plain host:port — the CLI calls Describe to learn the worker's languages and capabilities):

REVUND_WORKERS=localhost:50052 revund review

What it does

The worker advertises one capability via the Describe RPC:

Capability RPC Purpose
parse Parse Returns the universal ParsedFile shape — use imports, top-level decls (class / interface / trait / enum / function), method+function bodies (with cyclomatic complexity, hash, canonical hash, blocks), and concern evidence (Presentation/State/Network/IO/Config/Business/DataAccess/Transport).

ResolveSymbols and RunDiagnostics are not implemented yet — the Revund CLI checks the capability list from Describe and skips RPCs the worker hasn't advertised.

Environment

Variable Default Purpose
REVUND_PHP_WORKER_PORT 50052 Bind port. Use 0 for OS-assigned (recommended when the CLI spawns the worker).

Contract

The wire contract is defined in proto/worker.proto, vendored inside the package. Generated PHP stubs land under proto/Revund/Worker/V1/ (built from the .proto via the composer proto script).

License

Apache-2.0