I am sure this has been asked before but I am having trouble finding what I need. I am building a CMS in Symfony 4.4 and need a dynamic router that gets its routs and page info from a database. Need that ability to have users add pages and remove them with ease.
I can find information on building dynamic pages using a parent slug like this "/blogs/{slug}" but I am trying to build this without the "/blogs/" so just "/{slug}".
Now as far as I understand I can't just use the routing annotations in a controller like this
/**
* @Route("/{path}", name="Pages")
*/
public function index($path, Request $request): Response {
...
}
as that would work for all routes but homepage and make other set routes not work (I believe, If I am wrong let me know, would love to be wrong.)
I was thinking I could write a PHP program that builds a Routes file in YAML, XML, or PHP based on the info in a database but was wondering if there is a more efficient or better way of building this functionality.
Still new to Symfony and feel like I don't know anything.