Extension Refactoring

I've removed a duplicated middleware file and refactored the extension to use the same callback format shown in the MM documentation.

Also I'm passing the `source_dir` and `environment` to the middleware as that info is going to be required to implement the include_path and to provide a few missing elements in the $_SERVER array.