Documentation for Middleware API.
Drupal has a Middleware API that it adopted from the broader PHP community.