The structure of Fructum Framework is quite simple.
Framwork uses the HMVC design template (hierarchical model-video controller).
The most highly level part of the framework is the input point - the file that provokes the launch of the application. In practice, it can be an index.php script for a web server, or an executable file of the operating system. In the input point, the application is always launched.
Applications are conditional concepts. These are classes that control the input and output of data. Separation into applications allows you to make your project universal - it will be able to start both from under the console and through the browser, while for each case you can write separate handlers, but with all this use the same libraries.
Examples of applications:
When the input point turns on the carrier (Include Require), it becomes possible to start the application.
The cargoer is looking for the right application, then the relevant instructions are executed. In the case of a web application, a router is launched, which determines the desired path, if the application is console, a single processor of console applications is launched.
All classes of the project (with the exception of the lowest level of Fructum) are contained in extensions, modules, hooks and the scripts of the framework (hereinafter system classes).
When you need to load any class, first of all, the cargoer checks the directory with hooks. Khuki are created to rewrite the scripts of the nucleus and extensions. Huki can also be used to write the application itself.
Secondly, the System catalog with system classes is checked. These classes are relatives for Fructum and their directory is not recommended to touch their directory in order to avoid problems with compatibility and updating the framework. If you want to change the system classes, use hooks - create a class -hook class with the same name, and it will not reach system scripts.
Lastly, extensions are checked. These are the additions of the framework that everyone can write and publish. They can also be used to write an application itself.
Expansion can have its own modules ("expansion of extensions"). The modules are created in case the expansion is large (for example, CMS) and provides for modification. To determine the module belonging to the expansion, it is enough to simply add the prefix with the name of the expansion to the name of the module (for example, Test_Moodule will be a module to expand TEST). If you add the module to a non -existent expansion, it will not be loaded.
The application in the Fructum Framework is a low -level system that determines the data handlers and controls the output of the answer. In other words, this is a system that accepts data, transfers it to the processor and then displays it.
Separation into applications is required in cases where the given and accepted data can be different. If you write a console application, it will be simple - simply receiving and giving data. However, web applications, in addition to ordinary data, reports cookies and headlines.
Fructum standard assembly contains two types of applications - console and web applications.
Combus applications are those applications that are launched through the command line or SSH and the only input data of the KP are arguments. Web applications are those applications that are launched through the browser and accept Get Post data, cookies, headlines, etc. The given data is also varied.
To launch your project, you need to perform two steps: 1. Connect the framework 2. Run the application
Standard assembly is tuned to be convenient when creating web applications. The aforementioned two steps of the launch are performed in the so -called entrance points. In the case of a web application, the inlet is index.php. This script takes on all HTTP requests, connects the framework and launches web applications.
If you want to write your type of application, we recommend that you take a script of a console application as a basis. Also, if desired, you can remake standard applications - rewrite a web application router or write it for console. This does not require additional knowledge, just study how standard applications work and write expansion or hook.
Console applications are the simplest - a router and controllers are not used here, as in web applications. The standard ConsoleApp application after starting is looking for a class handler console and calls the Run () method in it. If there is no such class, a critical error will occur
Class Fructum Config contains the necessary configuration of the framework. To change it, you should create your own hook by copying /system/fructum/config.php in /hooks/fructum/config.php and change the contents to what you need. Each parameter is documented
If your extension requires tuning, do not create your class - just contact the Constants of the Fructum Config class. Add information about what data should be added to the configuration in the instructions for the installation of expansion.
Pay attention! Data in the configuration is constant, not variables. Use COST control.
All detailed information is available to Vicki: http://wiki.blockstudio.net/wiki/fructum