At the root of any good app is a set of good configuration files. This is the path configuration file from the minimalistic PHP framework I created for my freelance work. It is one of the first files loaded and is used to set the primary paths that are used throughout the code base.
<?php
// UNCOMMENT FOR DEVELOPMENT
//error_reporting(E_ALL);
// PATH DEFINITIONS
// TELL PHP THE DIRECTOR SEPARATOR FOR WINDOWS == \ UNIX == /
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
// UNCOMMENT THE LINE BELOW TO GET THE CORRECT WORKING DIRECTORY PATH
//echo getcwd();
//PATH TO THE SITE ROOT
defined('SITE_ROOT') ? null : define('SITE_ROOT',str_replace("system", "", getcwd()));
//PATH TO SYSTEM FILES
defined('SYSTEM_PATH') ? null : define('SYSTEM_PATH', SITE_ROOT.DS.'system'.DS);
defined('SYSTEM_INCLUDES_PATH') ? null : define('SYSTEM_INCLUDES_PATH', SITE_ROOT.DS.'system'.DS.'includes'.DS);
defined('SYSTEM_CLASSES_PATH') ? null : define('SYSTEM_CLASSES_PATH', SITE_ROOT.DS.'system'.DS.'classes'.DS);
// PATH TO APP FILES
defined('APP_PATH') ? null : define('APP_PATH', SITE_ROOT.DS.'app'.DS);
defined('APP_IMAGES_PATH') ? null : define('APP_IMAGES_PATH', SITE_ROOT.DS.'app'.DS.'images'.DS);
defined('INCLUDES_PATH') ? null : define('INCLUDES_PATH', SITE_ROOT.DS.'app'.DS.'includes'.DS);
defined('CLASSES_PATH') ? null : define('CLASSES_PATH', SITE_ROOT.DS.'app'.DS.'classes'.DS);
defined('CONTROLLERS_PATH') ? null : define('CONTROLLERS_PATH', SITE_ROOT.DS.'app'.DS.'controllers'.DS);
defined('MODELS_PATH') ? null : define('MODELS_PATH', SITE_ROOT.DS.'app'.DS.'models'.DS);
defined('VIEWS_PATH') ? null : define('VIEWS_PATH', SITE_ROOT.DS.'app'.DS.'views'.DS);
defined('JS_PATH') ? null : define('JS_PATH', SITE_ROOT.DS.DS.'app'.'js'.DS);
defined('CSS_PATH') ? null : define('CSS_PATH', SITE_ROOT.DS.'app'.DS.'css'.DS);
?>