ricardoper / slim3-skeleton

Slim Framework v3.5 Skeleton With Twig Views, Flash Messages, Logger, VarDumper, Environment Variables And A Folder Structure With Sense
MIT License
45 stars 7 forks source link

Route helper in Controller #2

Closed faurelia closed 5 years ago

faurelia commented 5 years ago

I might have missed it when I searched so I'm sorry but is there an easy way to access routes for redirecting ? Currently, I'm doing this inside the controller method which is kinda long:

$this->getContainer()->get('router')->pathFor('login')
ricardoper commented 5 years ago

Hello @faurelia ,

Thanks for your question.

At this moment this Skeleton don't have any URL helper, so you need to use the Slim 3 methods.

Yes, it's large, but this is the normal way in Slim 3: http://www.slimframework.com/docs/v3/objects/router.html#route-names

You mention redirects, so maybe this can help you too: http://www.slimframework.com/docs/v3/objects/router.html#redirect-helper

If I miss understood the question or you need more help, give me a second chance...

Regards, Ricardo Pereira.