Read this in other languages: English, Русский.
You can use this template to make a new extension for MikoPBX. I contains a web UI, with JS, CSS and PHP classes and database.
- app folder - for MVC part of project in compliance with the Phalcon app Structure
- bin folder - for binary executable files
- coreapi folder - for REST API classes
- db folder - module database is created automatically within the installation process according to ORM Models annotations
- lib folder - for main program classes
- messages folder - for translation files, like ru.php, en.php ...
- Models folder - ORM models are described compliance with the Phalcon Models Structure
- public folder - for public accessible files, i.e. js, css, images
- setup folder - for installation and uninstallation classes, and additional firewall rules
You can use this bash script to prepare your copy or you may follow the next steps:
- Make new repository and clone your new one to Phpstorm project.
- Make group renaming in folder:
ModuleQueueCallBack
to new unique module ID, i.e.MyCompanyMyNewModule4PBX
module_queue_call_back
toMyCompanyMod4PBX_tpl
module-queue-call-back
tomy-company-module-4-pbx
-
Change filename of controller class in folder
app/controllers
fromModuleQueueCallBackController.php
toMyCompanyMyNewModule4PBXController.php
-
Change filename of form class in folder
app/forms
fromModuleQueueCallBackForm.php
toMyCompanyMyNewModule4PBXForm.php
-
Rename and edit classes in
Models
folder for future database according to the Phalcon app Structure and Phalcon models annotations -
Rename JS и CSS files in folder
public/src
frommy-company-module-4-pbx-index.js
tomy-company-module-4-pbx.css
-
If your future module has to open any firewall ports, describe it at
setup/FirewallRules.php
or just delete this file, if you don't need it. -
Modify
module.json
, change module unique ID, developer’s name, version information and update/add functions to install your future module correctly.
This file must have at least one function __construct()
.
You can inherit the other function from parent class PbxExtensionBase
You must use namespace like Modules\<ModuleUniqueID>\Models
. Every file has to extend ModuleBaseClass
In class ModuleBaseClass
you must have the following method: getRepresent()
At every controller public method you must specify the module view file template path:
$this->view->pick( "{$modulesDir}/<ModuleUniqueID>/app/views/index" );
Your module has to have at 1 file e.g.: en.php
with at least 2 translated phrases being there in the file:
- Breadcrumb - Your module name
- SubHeader - Your module description for subheader
Before creating a new module you may read some docs:
Code style guides:
You are welcome to our telegram channel for developers @mikopbx_dev