Request-Response

Request-response is a communication pattern where a caller (client) sends a request and synchronously waits for the callee (server) to return a response before continuing. It is the fundamental interaction model of HTTP, RPC, and most database queries.

In the request-response pattern, the caller is blocked while the server processes the request. The server handles the request, computes a result, and sends it back. The caller then resumes with the result. Both parties must be available simultaneously.

This is distinct from fire-and-forget (no response expected), pub/sub (no direct coupling between publisher and subscriber), and streaming (continuous flow of data rather than a single response).

PHP’s traditional execution model is built entirely around request-response: the browser (client) sends an HTTP request, PHP processes it synchronously and returns an HTTP response. This model is simple and debuggable but imposes a one-request-per-worker constraint without async extensions.

<?php

// PHP is the server side of the HTTP request-response pattern
// Every PHP-FPM request follows this lifecycle:

// 1. Client sends: GET /orders/42 HTTP/1.1
// 2. PHP receives, processes, and returns:
http_response_code(200);
header('Content-Type: application/json');
echo json_encode(['id' => 42, 'status' => 'shipped']);

// PHP as the client side (HTTP request-response to a downstream service):
$response = $httpClient->get('https://payment-service/status/42');
// Client blocks here until payment-service responds
$status = $response->toArray()['status'];

// Contrast with fire-and-forget (no wait):
$queue->push(new SendEmailJob($user)); // returns immediately, no response

?>

Documentation

See also Wikipedia: Request-response.

Related : Hyper Text Transfer Protocol (HTTP), Synchronous, Fire-and-forget, Pub/Sub, Asynchronous, API Gateway