> For the complete documentation index, see [llms.txt](https://exiang.gitbook.io/yeebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://exiang.gitbook.io/yeebase/others/yeemodule-functions.md).

# YeeModule Functions

There are 2 methods to install a new module, either by manually upload it or thru marketplace. For method 1, backend provides an interface to upload the module. Method 2 is not implemented yet.

Uploaded module will be automatically extracted and place into `protected/modules` folder. Then, Super Admin will needs to initialize it from the backend under 'New Modules' tab. Initialization will create `protected/modules/xyz/config/main.php` and `protected/modules/xyz/config/console.php` from the distribute version, then auto call install function in the module to setup database such as table, setting, meta structure and etc.

If a module already exists (it is just a version upgrade), Super Admin will needs to upgrade it from the backend. The system will then loop thru all the possible upgrade scripts of this module base on semantic versioning and call the correct one.

All installed/upgraded module has a carbon copy in the database under  `module` table. This table keeps track of the installed version of the module, and is it enable/disabled.

Yii will automatically include all modules found in the folder `protected/modules` as long as module config files are found. Developer will need to explicitly check if the module enabled/disabled and not having a version mismatch issue by calling the database.

#### getCoreModules

`getCoreModules()`

This return the list of core module keys in flat array form: `'yee', 'gii', 'egg', 'sys', 'i18n', 'language', 'inspinia'`

#### getNewModules

`getNewModules()`

find all modules that are new and do not have config files initialized so is uncovered by getAllModules()

#### getAllModules

`getAllModules()`

#### getActiveModuleKeys

`getActiveModuleKeys($forceRefresh = false)`

#### getActiveParsableModules

`getActiveParsableModules()`

#### getParsableModules

`getParsableModules()`

#### hasParsableModules

`hasParsableModules($moduleKey)`

#### getModuleAbout

`getModuleAbout($moduleKey)`

This will parse the `about.yaml` file in module's `config` folder and return as an array.&#x20;

#### getModuleDb

`getModuleDb($moduleKey)`

This will return the module corresponding record in the database as a `Module` model object.

#### canModuleBeInstall

`canModuleBeInstall($moduleKey)`

#### canModuleBeConfigure

`canModuleBeConfigure($moduleKey)`

#### countModuleCanUpgrade

`countModuleCanUpgrade()`

#### canModuleUpgrade

`canModuleUpgrade($moduleKey)`

#### updateModule

`updateModule($moduleKey)`

#### composeNavItems

`composeNavItems($navId, $controller, $original)`

#### hasActiveModule

`hasActiveModule($moduleKey)`

#### getControllers

`getControllers($moduleKey, $withPostfixController = true)`
