daveh / php-mvc

A simple PHP model-view-controller framework, built step-by-step as part of the "Write PHP like a pro: build an MVC framework from scratch" course on Udemy.
https://davehollingworth.com/go/phpmvc/
MIT License
782 stars 311 forks source link

Dynamic route URL #97

Closed Thlenzi closed 3 years ago

Thlenzi commented 3 years ago

Hi! The standard route settings are based in this: $router->add('', ['controller' => 'Home', 'action' => 'index']); $router->add('posts/index', ['controller' => 'Posts', 'action' => 'index']);

@daveh , how can i set the route for dynamic url like: @*, domain.com/@foo, domain.com/@bar ... ???

Have a nice day!

daveh commented 3 years ago

I'm not sure what you mean - you can have variables in the route, which can map to the controller and action - have a look at the readme here.

Thlenzi commented 3 years ago

@daveh , i find a solution in base this your awnser. link