The Fast and Easy PHP Framework for Rapid Development.
classes/ example project classes
classes/db/ example DB beans classes
conf/ configuration files
controllers/ example controllers
framework/ core framework code
modules/ example modules
templates/ example templates
tests/ tests of the core framework code
The minimum requirement by Asymptix Framework is that your Web server supports PHP 5.3.
To install basic framework libs use Composer composer install
command with composer.json
configuration file (current version doesn't support Packagist yet and uses SVN for load just subfolder of the repository directly from GitHub. This will be improved in future).
{
"repositories": [
{
"type": "package",
"package": {
"name": "asymptix/framework",
"version": "dev-master",
"source": {
"type": "svn",
"url": "https://github.com/Asymptix/Framework",
"reference": "trunk/framework"
},
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"Asymptix\\": ""
}
}
}
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0",
"asymptix/framework": ">=2.0.0"
}
}
After Composer installation you just need require autoload file with the next command:
require_once("./vendor/autoload.php");
$_CONFIG- List of pairs key → value for global system configuration, like DB connections parameters, site URL, admin e-mail, etc. May be in old versions of the framework, now changed on Config object and partly replaced with $_SETTINGS variable (deprecated).- $_SETTINGS - List of pairs key → value for global system settings. Can be taken from the database or manually created.
- $_MENU - Multi-level array with main menu structure. Can be as global variable or as static property of the Menu class.
$_PATH- Old version to set absolute path to the project's folder (deprecated).
- $_USER - Variable stores serialized object of the User class or simple array with user data.
- $_ROUTE - Global instance of the Route class with public properties controller, action and id - represents current page URL or rules to display this page.
- $_TPL - String variable with a path to the needed template of the page.
- $_BREADCRUMBS - Array with page breadcrumbs data.
- $_JS - Controller local array with paths to needed for the current page JavaScript files.
- $_CSS - Controller local array with paths to needed for the current page CSS files.
- $_LANG -
Language
object stored in session and represents current selected language in localization functionality.
- $_FIELDS - List with pairs key → value merged from $_REQUEST ($_POST and $_GET) also used in form output if some data is invalid. Fields values may be changed on the way from data receiving before output in form fields.
- $_ARGS - List with pairs key → value from $_GET string, so it's not a copy of $_GET but received from URL string data after ‘?’ sign.
- $_ERRORS List of the errors for invalid or notable fields after validation process or some notification process.
- $_MESSAGES List of messages shown after form submission if some errors or notifications. Not connected to fields but common for all forms.
- $_FILTER List of filters (data selection rules) for some forms.
- $_EMAIL - Uses only in e-mail templates as e-mail inline parameters list (e.g. username, password or product name and price in e-mail templates).
It's highly recommended to send header information with framework signature for better recognition with parsers and analyzers (like Wappalyzer). You may see example in the index.php file:
header('X-Powered-By: Asymptix PHP Framework, PHP/' . phpversion());
You can create new DBObject:
$user = new User();
or you can get DBObject with DBSelector:
$userSelector = new DBSelector(new User());
$user = $userSelector->selectDBObjectById($userId);
You can manipulate with DataBase records this way:
// Save (insert/update) record
$user->email = "dmytro@asymptix.com";
$user->save();
If ID of the DBObject is empty - then INSERT SQL instruction will be executed, if not empty - then UPDATE.
// Delete record
$user->delete();
You can also use this syntax for the fast selection queries:
// Init object
$site = new Site();
$sitesList = $site->select(array('status' => "active"))
->order(array('title' => "ASC"))
->limit(10)
->go();
This query will be executed with using of Prepared Statement. Order of methods calls is free but go() - must be the last call in this order.
require_once("./core/OutputStream.php");
OutputStream::start();
OutputStream::output("Simpel text \n");
OutputStream::line("Simpel text line");
OutputStream::line("Simpel text line");
OutputStream::line();
OutputStream::log("Simple default log");
OutputStream::log("Simple log with time format", "\(H:i:s\)");
OutputStream::log("Simple log with time {{time}} label");
OutputStream::log("Simple log with time {{time}} label and format", "\(H:i:s\)");
OutputStream::log("Log with few time {{time}} labels {{time}}");
OutputStream::line();
OutputStream::msg(OutputStream::MSG_INFO, "Info message");
OutputStream::msg(OutputStream::MSG_DEBUG, "Debug message with time format", "\(H:i:s\)");
OutputStream::msg(OutputStream::MSG_SUCCESS, "Success message with time {{time}} label");
OutputStream::msg(OutputStream::MSG_WARNING, "Warning message with time {{time}} label and format", "\(H:i:s\)");
OutputStream::msg(OutputStream::MSG_ERROR, "Default Error message");
OutputStream::close();
Copyright (c) 2015 Asymptix.