spiral/goridge
High-performance PHP-to-Golang RPC bridge
Maintainers
Package info
Type:goridge
pkg:composer/spiral/goridge
Fund package maintenance!
Requires
- php: >=8.1
- ext-json: *
- ext-sockets: *
- spiral/roadrunner: ^2023 || ^2024.1 || ^2025.1
Requires (Dev)
- google/protobuf: ^3.22 || ^4.0
- infection/infection: ^0.29.0
- jetbrains/phpstorm-attributes: ^1.0
- phpunit/phpunit: ^10.5.45
- rybakit/msgpack: ^0.7
- spiral/code-style: *
- vimeo/psalm: ^6.0
Suggests
- ext-msgpack: MessagePack codec support
- ext-protobuf: Protobuf codec support
- google/protobuf: (^3.0) Protobuf codec support
- rybakit/msgpack: (^0.7) MessagePack codec support
Provides
None
Conflicts
None
Replaces
None
MIT a14454ce6c9cfcec76bbd283292c25fb33fc5a43
- Anton Titov (wolfy-j) <wolfy-j.woop@spiralscout.com>
- Valery Piashchynski
- Aleksei Gagarin (roxblnfk)
- Pavel Buchnev (butschster) <pavel.buchnev.woop@spiralscout.com>
- Maksim Smakouz (msmakouz) <maksim.smakouz.woop@spiralscout.com>
- RoadRunner Community
This package is auto-updated.
Last update: 2026-06-05 16:37:38 UTC
README
👁 ImageHigh-performance PHP-to-Golang IPC bridge
👁 Latest Stable Version
👁 CI
👁 Codecov
👁 Chat
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
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 or msgpack
[]bytetransfer, including big payloads- service, message and transport level error handling
- hackable
- works on Windows
- unix sockets powered (also on Windows)
Installation
composer require spiral/goridge
Example
<?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 = new Goridge\RPC\RPC(Goridge\Relay::create('tcp://127.0.0.1:6001')); $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.
License
The MIT License (MIT). Please see LICENSE for more information.
