roadrunner / goridge
High-performance PHP-to-Go IPC bridge: the RPC transport between PHP workers and the RoadRunner application server
Fund package maintenance!
Requires
- php: >=8.2
- ext-json: *
- ext-sockets: *
- spiral/roadrunner: ^3.0
Requires (Dev)
- google/protobuf: ^3.22 || ^4.0 || ^5.0
- jetbrains/phpstorm-attributes: ^1.0
- rybakit/msgpack: ^0.7
- spiral/code-style: ^2.3.1
- testo/testo: ^0.10.55
- vimeo/psalm: ^6 || ^7
Suggests
- ext-msgpack: MessagePack codec support
- ext-protobuf: Protobuf codec support
- google/protobuf: (^3.22 || ^4.0 || ^5.0) Protobuf codec support
- rybakit/msgpack: (^0.7) MessagePack codec support
Provides
None
Conflicts
None
Replaces
- spiral/goridge: 4.5.0
- 4.x-dev
- 4.5.0
- 4.4.0
- 4.3.0
- 4.2.2
- 4.2.1
- v4.2.0
- 4.1.1
- 4.1.0
- 4.0.0
- v3.2.1
- v3.2.0
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v3.0.0-beta4
- v3.0.0-beta3
- v3.0.0-beta2
- v3.0.0-beta1
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- 2.4.1
- 2.4.0
- v2.3.3
- v2.3.2
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-release-please--branches--4.x--components--roadrunner/goridge
- dev-maintenance
This package is auto-updated.
Last update: 2026-10-10 12:54:35 UTC
README
High-performance PHP-to-Golang IPC bridge
Goridge is a high-performance PHP-to-Golang codec library which works over native PHP sockets and the Golang net/rpc package. The library allows you to call Go service methods from PHP with minimal footprint, structures and []byte support.
The Golang part lives in roadrunner-server/goridge; the library is the transport layer of RoadRunner, a high-performance PHP application server, load-balancer and process manager written in Golang.
Get Started
Installation
composer require roadrunner/goridge
Calling a Go service
<?php use Spiral\Goridge; require "vendor/autoload.php"; $rpc = new Goridge\RPC\RPC( Goridge\Relay::create('tcp://127.0.0.1:6001') ); //or, using factory: $tcpRPC = Goridge\RPC\RPC::create('tcp://127.0.0.1:6001'); $unixRPC = Goridge\RPC\RPC::create('unix:///tmp/rpc.sock'); $streamRPC = Goridge\RPC\RPC::create('pipes://stdin:stdout'); echo $rpc->call("App.Hi", "Antony");
Factory applies the next format:
<protocol>://<arg1>:<arg2>
More examples, including the Go server side, can be found in this directory.
Codecs
JSON is the default codec. Use withCodec() to switch to MsgpackCodec, ProtobufCodec or RawCodec from the Spiral\Goridge\RPC\Codec namespace.
Features
- no external dependencies or services, drop-in (64bit PHP version required)
- sockets over TCP or Unix (ext-sockets is required), standard pipes
- very fast (300k calls per second on Ryzen 1700X over 20 threads)
- native
net/rpcintegration, ability to connect to existing application(s) - standalone protocol usage
- structured data transfer using JSON, MessagePack or Protobuf, and raw payloads
[]bytetransfer, including big payloads- asynchronous calls over a pool of relays with
MultiRPC - service, message and transport level error handling
- hackable
- works on Windows
- unix sockets powered (also on Windows)