2015
Middleware exists in a mature form in many languages, including Java, Ruby, Python, or Node. PHP is also warming up to this idea. This presentation focuses on HTTP middleware, HttpKernelInterface interface and implementations.
8. Pipes-and-Filters Pattern
The Pipes and Filters architectural
pattern provides a structure for
systems, having components that
process a stream of data (filters) and
connections that transmit data
between adjacent components (pipes).
11. Rack definitions
Environment
Environment variables representing the HTTP request. Mostly taken
from CGI, but has additional Rack-specific variables.
Response
The response format. It is an array with three elements: The status
code, a hash of headers and a list of strings for the body.
Application
An app is an object with a call method. The input argument is an env
hash, the return value a response array.
12. Ruby
class HelloWorld
def call(env)
[200, {"Content-Type" => "text/plain"}, ["Hello world!"]]
end
end
class HelloWorld def call(env) [200, {"Content-Type" => "text/plain"}, ["Hello world!"]] end end
13. Why shall we care,
we have SAPI
$_SERVER, $_ENV, $_GET, $_POST, $_COOKIE, $_FILES and
$_REQUEST