Is it possible to create a module in Magento 2, using standard routing, that responds to a URL in the form of
http://magento.example.com/namespace_module/return/index
That is -- a URL where the second parameter is a PHP reserved keyword. The problem with the above is is create a PHP controller class name that's
Namespace\Module\Controller\Return\Index
and having Return
in the namespace is illegal PHP. I know if the URL's final parameter (traditionally called the action) was a reserved keyword
http://magento.example.com/namespace_module/foo/return
that Magento would let me create a controller class named
Namespace\Module\Controller\Foo\ReturnAction
However, this does not work for the second parameter.
Is there a way to do this using standard Magento 2 routing techniques?
If not, is there a generally considered best practice for injecting a custom router object to get this behavior, or some other technique that would let me work around this? (an after
plugin on Magento\Framework\App\Router\ActionList
?)