Modules in Framelix are basically a App
. Each module can be a full application.
It includes all source code and resources to serve an application.
Module structure
A module is a folder inside /framelix/appdata/modules
where the folder name
is the module name.
The FramelixStarter
module is integrated in every docker image, a starting point for each new
module.
You can goto Setup for module development for how to create a new module.
The minimal file structure of a module is as followed (Beginning from the module folder):
- _meta - A folder that contain auto-generated metadata about several views and other things inside your module. It is mostly used as a cache, to save resources in production systems (Storing class data and so on...)
-
lang - A folder that contains all translation
.json
files for your module. Framelix have multi-language support. -
public - This folder is the entry point for your application.
It always contains a
index.php
file. Every request is forwarded to this file (Except for urls with a special prefix).
Examples:- Default:
https://{appurl}/xyz
- Will be routed through index.php - Starting with __{modulename}:
https://{appurl}/__Framelix/test.png
- Will serve a file that is inside the userdata public folder. In this example it will serve a file from/framelix/userdata/Framelix/public/test.png
This can be used for all user generated files, like uploads. - Starting with _{modulename}:
https://{appurl}/_Framelix/img/logo.png
- Will serve a file that is inside the modules public folder. In this example inFramelix/public/img/logo.png
This is used for resource file urls from module to be included in the browser (Images, libraries, etc...) - Starting with ${modulename}:
https://{appurl}/$Framelix/en.json
- Will serve a file that is inside the modules lang folder. In this example inFramelix/lang/en.json
This is used for language files to be available to be loaded async, when they are needed in the frontend.
- Default:
-
public/dist - A folder that contains all auto-generated compiled source files, that are added
with
Framelix/src/Html/CompilerFileBundle.php . This files are used to be included in the frontend (CSS and JS). - src - A folder that contains all PHP source code for the module.
- js/scss - The folders that contains JS and CSS/SCSS files for the compiler. It is not available directly in the browser, it is used as source for the SCSS/JS compilers.
- more folders - You can add as many folders as you like. If you use composer for example, you will
most like have a
vendor
folder. Theautoload.php
is automatically included, when there is one.