4 ms·
Which begs the question, how on earth do you choose one? Edit: as in, which router do you pick and how do you pick one? Choice can lead to decision paralysis.
by insky 12y ago
Which begs the question, how on earth do you choose one?
Edit: as in, which router do you pick and how do you pick one? Choice can lead to decision paralysis.
- apsdehal 12y agoCheck whats your need, if you are building up much bigger apps go for a fully fledged framework, rest for small apps you can use microrouters , according to your need, each has its own unique features.
- icedchai 12y agoFor small apps, you don't need a "router", period. Routing is done by the file system and placing .php files in directories!
- krapp 12y agoOne of the benefits of using a url router is access control - you could have a problem with just letting every file be executable by url, especially if you happen to have a remote file inclusion issue anywhere. With a router you know explicitly what can get invoked and what can't. Although, doing it without a router is probably always going to be faster.
- insky 12y agoA late trick I discovered, was that you can configure your php instance to inclued a file with every script. For example the following can be added to .htaccess: php_value auto_prepend_file 'before.php' You can then use that for bootstrapping, front controller and to limit access. Can be a bit clumsy, but it's nicely divorced from simple page controllers.
- icedchai 12y agoneat! this beats putting an include at the top of each file...
- krapp 12y agoIt certainly does. I personally would still prefer a router but I know of a project which was written almost entirely in sprawling, procedural PHP that might benefit from this. Although I do wonder what the performance hit would be.