Jump to content

Known methods to application bootstrapping?


ignace

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.