--- title: Output Buffering Middleware --- The Output Buffering Middleware enables you to switch between two modes of output buffering: `APPEND` (default) and `PREPEND` mode. The `APPEND` mode will use the existing response body to append the contents. The `PREPEND` mode will create a new response body object and prepend the contents to the output from the existing response body. This middleware should be placed in the center of the middleware stack so it gets executed last. ## Usage ```php add($outputBufferingMiddleware); // ... $app->run(); ```