Development - File Structure for standard application
Below the File Structure for standard application:
-
assets/ directory where placed all asset files
-
modules/ directory for storing application modules
-
vendors/ directory for storing vendor files
-
images/ directory where placed all public images
-
css/ directory where placed all public css files
-
js/ directory where placed all public javascript files
-
protected/ directory where placed all files of applications
-
components/ directory for storing application component files
-
config/ directory for storing configuration files
- main.php main cofiguration file
- db.php database cofiguration file
-
controllers/ directory for storing cotroller classes
- ErrorController.php ErrorController class
- IndexController.php IndexController class
-
data/ containing the sample database
- config.db.tpl template for database configuration file
- config.main.tpl template for main configuration file
- schema.mysql.sql DB schema for MySQL database installation
- schema.update.mysql.sql DB schema for MySQL database update
-
messages/ directory for storing messages
-
en/ English translation
- app.php main translation file for application
-
models/ directory for storing model classes
- Login.php Login model class
-
modules/ directory for storing modules files
-
tmp/ directory for storing temporary files
-
backups/ directory for backup files
-
cache/ directory for cache files
-
logs/ directory for log files
-
views/ directory for storing view classes
-
index/ Index view directory
- index.php Index/index view file
- .htaccess protected folder .haccess file
-
templates/ directory where placed all templates
- default/ all public files for a specific template
- css css files for template
- images image files for template
- js javascript files for template
- default.php default (master) template file
- .htaccess templates directory .haccess file
- .htaccess application .haccess file
- index.php application entry point
protected/.htaccess
- htaccess file denies access to protected directory from all ¶
deny from all
templates/.htaccess
- htaccess file denies access to all PHP files in templates directory ¶
<FILES ~ "\.php$">
Order allow,deny
Deny from all
</FILES>
.htaccess
- htaccess file converts all requests into url parameter and perform following directives ¶
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
# Recommended directive to disable directory browsing
Options All -Indexes
index.php
- main HTTP request dispatcher file ¶
// Change the following paths if necessary
defined('APPHP_PATH') || define('APPHP_PATH', dirname(__FILE__));
// Directory separator
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
// Production | debug | demo | test | hidden
defined('APPHP_MODE') or define('APPHP_MODE', 'debug');
$apphp = dirname(__FILE__).'/../../framework/Apphp.php';
$config = APPHP_PATH.'/protected/config/';
require_once($apphp);
A::init($config)->run();