Repository navigation
Replies: 1 comment
|
@keasy9 Good question! Before going down the composition path, same question as in #211: what does $app = new FrameworkX\App();
$app->get('/', …);
$app->post('/users', …);Routes from places without On the internals: you're not missing anything. I hope this helps. Please let me know if this solves your use case and also curious to hear more about what you're building 👍 |
Uh oh!
There was an error while loading. Please reload this page.
I started to building with framework X. My current micro-goal - make facade for adding routes, like:
To do this I need to add
RouteCollectorto container. I can't do it after app is Initialized, because App::$router is private. And becauseContainerhas noaddmethod. And I cant extend class to add it becauseContainer::$loaderis private.So maybe I can swap whole
RouteCollector? Of cource not. Why?Because
App::__constructmakes new one, not matters is it in container already or not (actuallyApp::__constructmakesRouteHandler, which makesRouteCollectorin its constructor). And I cant extend it and redeclare$routerbecause (again)App::$routeris private.So, I need to replace whole container (make +1 dependency in composer) to just getting
RouteCollectorinside it in clearly way. Or I am missing something?All reactions