Zend Framework 1 had a very simple way of analyzing URL routes and setting the parameters found in the $ _GET superglobal file for easy access. Of course, you can use β getParam ($ something) inside the controller, but if the parameter was found in the URL, it was also accessible via $ _GET.
Example for the URL mypage.com/mymodule/mycontroller/myaction/someparam/5:
Zf1
$this->getParam('someparam'); // 5 $_GET['someparam']; // 5
Zf2
$this->getEvent()->getRouteMatch()->getParam('someparam');
Obviously, the difference is that ZF2 does NOT put route parameters into the superglobal value of $ _GET.
How to make it analyze the parameters in the $ _GET supergalbal, since the extension of the controller and just defining a constructor that does this is out of the question (since RouteMatch is not an object yet and cannot be called from the controller's constructor)?
Call $_GET = $this->getEvent()->getRouteMatch()->getParam('someparam'); will work in each of my controllers, but I do not want this.
In other words, following the example URL above, I want to be able to do $ _GET ['someparam'] and still get the value "5" in any component of the application.
Edit: It seems I was not clear enough, so I will try to clarify something else. I want any parameter that I entered in the URL via form / key / value to be available in $ _GET instantly. I really have no problem getting the parameter, I know how to get it, and I expanded the Zend controller, so I can just call $ this-> getParams again, as in ZF1, and now all the controllers expand this one, I just want the parameters from URLs will automatically be in $ _GET, so I can easily access them in third-party components that use $ _GET natively.
Edit 2: Updated as a reaction to Samuel Herzog: Actually, I do not mean SRP invalidity in this case, because libraries are built in such a way that they need direct access to $ _GET - they perform their own filtering and are directly dependent on this superglobal. They also directly extract $ _FILES and $ _POST for processing, this is exactly how their code works.
In the abstract controller, I made the following method: $ This-> mergeGet (); which basically causes $ _GET to absorb all the parameters matched by the route, and everything works as intended, but seeing that the libraries will be needed in each controller / action, it may require a tedious call to this method every time. If only the controller had an init () method, as in ZF1 ...