4 ms·
At a guess because you don't use apache, you don't have .htaccess / conf permissions, you are going to distribute your script and can't rely on the above, your
by RobAley 12y ago
At a guess because you don't use apache, you don't have .htaccess / conf permissions, you are going to distribute your script and can't rely on the above, your router uses database or other external sources, you want to be like the cool kids, or because you want to, it works, and why not?
- 127001brewer 12y agoLet's say you are using Apache (so maybe that already means you're not one of the cool kids?), then why would you use any of the available PHP routers? Overall, I'm not trying to discount anyone's work with developing PHP routers, but I'd like to understand the benefits of using them.
- bartonfink 12y agoIt would help decouple your application code and structure from Apache configuration and the need to be familiar with Apache configuration syntax and nuance. Your Apache config would just need to route all requests to your app root to one routing file, which is pretty simple, and then the routing file can process from there. You'd also have the benefits of more configurable routing, if you needed that (e.g. routing based on specific parameters in a POST instead of just based on the request url and method).
- Nickoladze 12y agoI would prefer to have all my behavior be in my codebase. Also, restarting Apache after adding a route would get tedious during development.
- insky 12y agoI guess you are asking why not just use the filesystem one-one like mapping url to file? A benefit of routing is that you can have a single point of contact in your app: a front controller. And you can place your route config in one place. This router also has RESTful routing, detecting HTTP methods upfront that correspond to a predictable method name in a named class.