High-performance PHP-to-Golang IPC bridge
Branch: master
Clone or download
Latest commit 5ea54ce Feb 5, 2019


High-performance PHP-to-Golang IPC bridge

Latest Stable Version GoDoc Build Status Scrutinizer Code Quality Go Report Card

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.

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
  • low message footprint (17 bytes over any binary payload), binary error detection
  • 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 existed application(s)
  • standalone protocol usage
  • structured data transfer using json
  • []byte transfer, including big payloads
  • service, message and transport level error handling
  • hackable
  • works on Windows


$ go get "github.com/spiral/goridge"
$ composer require spiral/goridge


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

$rpc = new Goridge\RPC(new Goridge\SocketRelay("", 6001));

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

import (

type App struct{}

func (s *App) Hi(name string, r *string) error {
	*r = fmt.Sprintf("Hello, %s!", name)
	return nil

func main() {
	ln, err := net.Listen("tcp", ":6001")
	if err != nil {


	for {
		conn, err := ln.Accept()
		if err != nil {
		go rpc.ServeCodec(goridge.NewCodec(conn))

Check this libraries in order to find suitable socket manager:


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