ignace Posted September 4, 2009 Share Posted September 4, 2009 Hi, How do you generally bootstrap your application or which other methods do you know besides: #1: Switch (Not really the best approach) switch ($page) { case 'home': include('home.php'); break; .. } #2: Using routing (most used) $defaultRoute = array('default', 'route', 'parts'); $errorRoute = array('error', 'route', 'parts'); $route = uri2route(); dispatch($route); #3: 'RESTful' based This is something I have been playing with. A browser is just another device like CLI to access your 'website' (or the data at that resource identifier) through the Accept header can the application identify what it should return. What are your thoughts, suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/173139-known-methods-to-application-bootstrapping/ Share on other sites More sharing options...
Daniel0 Posted September 4, 2009 Share Posted September 4, 2009 Routing is just a collective term for mapping a request to some sort of resource in your business logic. In fact, it means what you call "bootstrapping" here. Specifically how you do it is not so important (to some extent). You will obviously want some sort of way that has some degree of modularity. E.g., having to alter a switch all the time would be cumbersome, and it would eventually result in a rather large switch; you would want something dynamically defined. Quote Link to comment https://forums.phpfreaks.com/topic/173139-known-methods-to-application-bootstrapping/#findComment-912745 Share on other sites More sharing options...
ignace Posted September 5, 2009 Author Share Posted September 5, 2009 Thx Daniel for your reply. Quote Link to comment https://forums.phpfreaks.com/topic/173139-known-methods-to-application-bootstrapping/#findComment-913078 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.