Setting up a project structure; I am thinking is it better to have somewhat of a “bootstrap.php” file that include and setup everything such as database connection, session management, libraries, error handling. Or just singulary include the file needed for the moment? (Which would need to prior the order of including, etcetera).
Alternative 1:
index.php
<?php
include 'bootstrap.php';
//session... database up and ready to be used...
Alternative 2:
index.php
<?php
include 'session.php';
include 'database.php';
include 'errorhandling.php';
//now use database...
Include only files that are required for a particular page. For example, if a page doesn’t require database connection, you would not include it. So latter approach is better to selectively include needed files unless you have some common stuff to import on every page.