High-performance PHP-to-Golang RPC bridge

Fund package maintenance!

Installs: 5 136 117

Dependents: 30

Suggesters: 0

Security: 0

Stars: 90

Watchers: 12

Forks: 9


v4.2.0 2024-04-11 17:26 UTC



High-performance PHP-to-Golang IPC bridge

Latest Stable Version CI Codecov Chat

PHPClasses Innovation Award

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package. The library allows you to call Go service methods from PHP with minimal footprint, structures and []byte support.
Golang source code can be found in this repository: goridge

See https://github.com/spiral/roadrunner - High-performance PHP application server, load-balancer and process manager written in Golang


  • 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/rpc integration, ability to connect to existing application(s)
  • standalone protocol usage
  • structured data transfer using json or msgpack
  • []byte transfer, including big payloads
  • service, message and transport level error handling
  • hackable
  • works on Windows
  • unix sockets powered (also on Windows)


composer require spiral/goridge



use Spiral\Goridge;
require "vendor/autoload.php";

$rpc = new Goridge\RPC\RPC(

//or, using factory:
$tcpRPC = new Goridge\RPC\RPC(Goridge\Relay::create('tcp://'));
$unixRPC = new Goridge\RPC\RPC(Goridge\Relay::create('unix:///tmp/rpc.sock'));
$streamRPC = new Goridge\RPC\RPC(Goridge\Relay::create('pipes://stdin:stdout'));

echo $rpc->call("App.Hi", "Antony");

Factory applies the next format: <protocol>://<arg1>:<arg2>

More examples can be found in this directory.


The MIT License (MIT). Please see LICENSE for more information.