laravel/framework — pull request #2088 by igorw (2013-08-13 14:20:23+00:00)
Title: Correctly implement HttpKernelInterface and TerminableInterface

Currently Laravel implements HttpKernelInterface, but handle() is not actually called when you call run(). In addition to that, handle violates HttpKernelInterface, because it internally requires an instance of laravel's request object.

This patch makes run() simply set up a request and delegate to handle() which then does the actual work. This way, handle() can be properly used without run(). For example in a testing context, or when composing with stack (stackphp.com) middlewares.

Another change is the termination handling. Post-response event listeners are now dispatched from terminate() which implements HttpKernel's TerminableInterface, allowing it to also nicely compose with stack.

The previous ->terminate() method now does nothing. That part is handled by ->run() directly. The empty method remains for BC.