I’m building a module based application, where a user can activate (buy) modules. Instead of creating subrequest in the way Neos CMS does it, I’m looking into one of the following approaches
1. RoutePartHandler
Create a routeparthandler that does something.
Not very well thought through yet… I will be overriding a @action and @controller at some point - I’m not really a fan of it.
2. HTTP Chain component
Imagine a request to the path www.application.tld/billing or www.application.tld/email/vacation
In Routes.yaml
all requests go into a ModuleController
- but before it reaches this I will have my own Http component that does the following:
Take the URI, ex. billing
or email/vacation
and split it by the first /
.
The first argument will be module
name. The second will be a @controller
and a third would be a @action
.
I register my module in a module manager, via a YAML syntax (nevermind that at the moment) and inside my Component i will do something like this (pure pseudo code)
if ($this->moduleManager->isModuleAvailable($module)) {
$module = $this->moduleManager->getModule($module);
$routingMatchResults = $componentContext->getParameter(Routing\RoutingComponent::class, 'matchResults');
$routingMatchResults['@controller'] = $module->getController();
$routingMatchResults['@action'] = $module->getAction();
$componentContext->setParameter(RoutingComponent::class, 'matchResults', $routingMatchResults);
}
This will be before the “dispatchComponent” that takes care of the request and security etc.
Am I looking into any troubles, going the HTTP Component way, in terms of speed, compiling in production context or anything?
Mainly looking for some inside knowledge by the core team or anyone who have been doing anything similar.