Emitters

To simplify the usage of Expressive, we added the run() method, which handles the incoming request, and emits a response.

The latter aspect, emitting the response, is the responsibility of an emitter. An emitter accepts a response instance, and then does something with it, usually sending the response back to a browser.

The zendframework/zend-httphandlerrunner package defines an EmitterInterface, and three emitter implementations. Two of these, Zend\HttpHandlerRunner\Emitter\SapiEmitter and Zend\HttpHandlerRunner\Emitter\SapiStreamEmitter, send headers and output using PHP's standard SAPI mechanisms (the header() method and the output buffer).

We recognize that there are times when you may want to use alternate emitter implementations; for example, if you use React, the SAPI emitter will likely not work for you.

To facilitate alternate emitters, we offer two facilities: