What is Boostrap.php and why is it used instead of index.php?

Asked

Viewed 32 times

1

I see that many frameworks/Ibraries have a file Index.php which only includes the Boostrap.php, and in that Bootstrap.php is included the autoload of Poser and other application files, because there is this practice of using the Bootstrap.php to start the application instead of Index.php?

  • Could you give an example of where you saw this?

1 answer

0

The index.php is in the public directory of your application src/public/index.php, and this includes bootstrap.php, where your code is actually initialized and is located in src/application/bootstrap.php, that is it is for security reasons that only index.php is in the public directory of the application, so regardless of the state the server the file cannot be accessed, and the file can contain sensitive information.

Read here an article explaining better.
That one stackoverflow question can also help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.