Product Decisions This Supports
- Microservices Integration: Enable seamless communication between PHP and Go microservices within a polyglot architecture, reducing dependency on monolithic PHP stacks while preserving existing workflows.
- Performance-Critical Workloads: Offload heavy computations (e.g., real-time data processing, ML inference, or cryptographic operations) to Go without rewriting PHP codebases, leveraging Go’s concurrency and performance advantages.
- RoadRunner Ecosystem: Accelerate adoption of RoadRunner by providing a native PHP ↔ Go IPC bridge, reducing latency in serverless/containerized deployments (e.g., Kubernetes, AWS Lambda).
- Gradual Migration: Facilitate phased modernization by allowing PHP services to call Go services incrementally, reducing risk and technical debt (e.g., migrating legacy PHP APIs to Go while keeping frontend logic in PHP).
- Binary/Streaming Data: Support high-throughput use cases like video transcoding, large file processing, or WebSocket streaming by leveraging
[]byte payloads and Unix sockets (300k+ calls/sec).
- Cost Optimization: Reduce cloud infrastructure costs by consolidating workloads (e.g., replacing multiple PHP workers with a single Go service handling heavy lifting via RPC).
- Feature Flags & A/B Testing: Use Go services for experimental features (e.g., new recommendation algorithms) while keeping PHP as the stable baseline, with Goridge as the communication layer.
When to Consider This Package
-
Adopt when:
- Your PHP application has performance bottlenecks (e.g., CPU-bound tasks, high-latency APIs) that cannot be optimized further in PHP.
- You’re using or planning to adopt RoadRunner for PHP application servers and need native Go integration.
- You require low-latency IPC between PHP and Go (e.g., real-time systems, trading platforms, or IoT pipelines).
- Your team has Go expertise to develop the service layer, but prefers PHP for business logic.
- You need to stream binary data (e.g., file uploads, video processing) between PHP and Go without serialization overhead.
- You’re building a polyglot microservices architecture and want to avoid HTTP/REST latency or complexity (e.g., gRPC/Protobuf).
-
Look elsewhere if:
- Your use case requires cross-language support beyond PHP/Go (e.g., Python, Java, Node.js). Consider gRPC or REST.
- You need strong typing or schema validation (e.g., OpenAPI/Swagger). Protobuf or JSON Schema might be better.
- Your team lacks Go development resources to maintain the service layer.
- You’re deploying in serverless environments where cold starts or ephemeral connections are problematic (Goridge requires persistent connections).
- You prioritize developer productivity over raw performance (e.g., if your team prefers HTTP APIs over RPC).
- Your payloads are extremely large (e.g., multi-GB files). Consider chunked streaming solutions like S3 or dedicated file transfer protocols.
How to Pitch It (Stakeholders)
For Executives:
"Goridge lets us leverage Go’s speed for performance-critical tasks—like real-time analytics or image processing—while keeping our PHP codebase intact. By offloading heavy lifting to Go via ultra-fast IPC (300k+ calls/sec), we can cut cloud costs, reduce latency, and modernize incrementally. It’s a drop-in solution that works with our existing RoadRunner setup, so we avoid reinventing the wheel. Think of it as ‘turbocharging’ our PHP apps without a full rewrite."
For Engineering/Architecture Teams:
*"Goridge provides a high-performance, low-latency bridge between PHP and Go, ideal for:
- Offloading CPU-bound tasks (e.g., ML, crypto, or data processing) to Go while keeping PHP for business logic.
- Seamless RoadRunner integration—no need for custom gRPC or HTTP proxies.
- Binary/streaming data support (e.g., video, large files) with minimal overhead.
- Gradual migration from PHP to Go by exposing Go services as RPC endpoints.
It’s mature (used in RoadRunner), well-documented, and supports TCP/Unix sockets, pipes, and JSON/MsgPack/Protobuf. If you’re already using Go for performance-critical components, this lets PHP talk to them efficiently."*
For Developers:
*"Goridge is a simple, fast way to call Go functions from PHP—no HTTP overhead, no serialization hassles. Just:
$rpc = new Goridge\RPC\RPC(Goridge\Relay::create('tcp://go-service:6001'));
$result = $rpc->call('Service.Process', $data); // 300k+ calls/sec!
Works with RoadRunner, supports binary data, and has built-in error handling. Perfect for:
- Speeding up slow PHP endpoints.
- Streaming data between PHP and Go.
- Avoiding REST/gRPC complexity for internal services."*