# Pragmatic groups and routes

**URL:** <https://discourse.slimframework.com/t/pragmatic-groups-and-routes/2139>\
**Category:** Questions\
**Created:** [January 6, 2018, 2:49am UTC](https://discourse.slimframework.com/t/pragmatic-groups-and-routes/2139 "2018-01-06T02:49:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkdotcom](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/bkdotcom/32/589_2.png) [@bkdotcom](https://discourse.slimframework.com/u/bkdotcom)\
**Post date:** [January 6, 2018, 2:49am UTC](https://discourse.slimframework.com/t/pragmatic-groups-and-routes/2139/1 "2018-01-06T02:49:08Z")

</div>

I have a nested array that represents a sites hierarchy / pages.  
Naively, I though I could walk this array… and call `$app->group()` to “open” a group and then `$app->any()` to add groups or routes to the current group… then perhaps some sort of `groupEnd()` or `popGroup()` to close the group while walking the array… However it appears that `$app->group()` requires a closure param from which route are added to the group…

Question 1: Is it possible to dynamically / pragmatically create groups?.

Question 2: Slim has the `routerCacheFile` option… is it possible to “skip right to the cachefile” and not even call `$app->get()`, `$app->any()`, etc?

---

<div class="post-metadata">

**Author:** ![bkdotcom](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/bkdotcom/32/589_2.png) [@bkdotcom](https://discourse.slimframework.com/u/bkdotcom)\
**Post date:** [January 8, 2018, 5:16pm UTC](https://discourse.slimframework.com/t/pragmatic-groups-and-routes/2139/2 "2018-01-08T17:16:45Z")

</div>

Question 3: Best practice for pragmatically generating a site-map ?

Seems like I’ll need to define routes and define a site-hierarchy separately…
