2.2 KiB
2.2 KiB
xdrm-framework
Description
xdrm-framework is a tool that wraps my framework and all it's component's versions. It allows to build a web framework's base with chosen modules and their versions.
1. Build a project
To use the xdrm-framework's project builder, just open a linux terminal and type :
xdrm-framework modules
- to display the available modulesxdrm-framework install {moduleName} 1.2
- to enable a module and its version (1.2 here)xdrm-framework remove {moduleName}
- to disable a modulexdrm-framework build
- will create your project in the folderbuilt
mv built {yourPath}/{yourProjectName}
- to move your project wherever you want
2. Project's file structure
xdrm-framework is based on all is in config
so you will have this structure :
- folder
build
which contains framework's modules. - folder
public_html
which contains visible content. - folder
config
which contains the modules' config files. - file
autoloader.php
which will auto-load the components.
Note: In every php file you want to use framework's classes, you have to begin your file by :
<?php
/* [1] dirname() as long as you're not at the project's root */
define('__ROOT__', dirname(dirname(__FILE__)));
require_once __ROOT__.'/autoloader.php';
/* [2] then you can load your classes */
use api\core\ModuleRequest;
use error\core\Error;
/* [3] and use them as long as you want without namespace */
$request = new ModuleRequest('module/method', ['id_user' => 10]);
$response = $request->dispatch();
if( $response->error === Error::Success )
echo "All is going right!\n";
Note: Some global constants are created into the autoloader:
__BUILD__
- The absolutebuild
folder path__PUBLIC__
- The absolutepublic_html
folder path__ROOT__
- The absoluteroot
path (project root)__CONFIG__
- The absoluteconfig
folder path