Service Communication: REST and gRPC
Connect services synchronously and efficiently.
REST and gRPC
Services need to talk synchronously: a request goes out, an answer comes back. The two dominant choices are REST over HTTP/JSON and gRPC over HTTP/2 + Protobuf. They optimize for different things — REST for reach and human-friendliness, gRPC for speed and strict contracts.
This lesson shows both from a PHP perspective and when to pick each.
REST: the Lingua Franca
REST models resources behind URLs and uses HTTP verbs and status codes for semantics. Its strengths: universal tooling, cacheability, debuggability with curl, and zero special client needs. Its weaknesses: verbose JSON, no enforced schema, and request/response only.
For public APIs and browser-facing endpoints, REST is almost always right.
All lessons in this course
- From Monolith to Microservices
- Service Communication: REST and gRPC
- API Gateways and Service Discovery
- Resilience: Circuit Breakers and Retries