element
Introduction
What is it?
The goal of this project is to create a lightweight MVC framework for PHP that can be easily deployed and updated within any hosting.
Many frameworks are fast and feature-rich, but the installation and update processes can be difficult in certain environments.
Updates are intended to only be released for the 'core' directory, allowing free-reign elsewhere, with a simple update path: slot in a new core!
Directory Structure
├───app │ ├───cache │ ├───configuration │ ├───controllers │ ├───helpers │ ├───models │ ├───templates_c │ └───views │ └───index ├───core │ └───Smarty │ └───libs │ ├───plugins │ └───sysplugins └───public
root │ .gitignore │ .htaccess │ index.php │ README.md │ ├───app │ ├───cache │ │ │ ├───configuration │ │ configuration.php │ │ │ ├───controllers │ │ IndexController.php │ │ │ ├───helpers │ │ IndexHelper.php │ │ │ ├───models │ │ │ ├───templates_c │ │ │ └───views │ └───index │ index.tpl │ ├───core │ │ Config.php │ │ Controller.php │ │ DAL.php │ │ DB.php │ │ Loader.php │ │ Model.php │ │ Navigator.php │ │ Request.php │ │ View.php │ │ │ └───Smarty │ └───libs │ ├───plugins │ └───sysplugins │ └───public .htaccess index.php 404.html
Routing
The .htaccess files control traffic throughout the framework.
- Root .htacces: Directs all traffic to the public folder
- Public .htaccess:
- Directs to a controller if the file or folder doesn't exist.
- Directs to file or folder if it does exist.
- Throws an error if no file/folder/controller of exist.
File Requires
We use spl_autoload for requiring files and loading classes. This looks in 'all the old familiar places' before extensively searching to expedite the process.
Caching
Caching can be disabled for development, but is recommended to be enabled in production.
See View for more information on view cache settings.
URL Structure
Example URL
http:// [yoursite.com] / [controller] / [method] / [parameter1] / [parameter2] ...
You may use absolute or 'pretty' urls
Absolute:
http://yoursite.com / app / controllers / IndexController.php
Pretty:
http:// yoursite.com / index
Urls can be supplied the method (action) and parameters
Absolute url with parameters:
http://yoursite.com / app / controllers / IndexController.php? action=index &; parameter1=value1
Pretty url with parameters:
http://yoursite.com/index/value1
NOTE: When using pretty urls, we pass the value only