[Proposal] Exctract global vars

This PR extract usage of PHP global variable to specific functions to allow us to overwrite them to use any of HTTP abstraction available over the web like Symfony Request class.