Windows
How to organize workspace for MikoPBX extension developement.
Last updated
Was this helpful?
How to organize workspace for MikoPBX extension developement.
Last updated
Was this helpful?
Core - files from the repository
Extensions - directory for storing module files
ModuleBackup - files from the repository
ModuleYourModule - directory with files of your module
MikoPBXUtils - directory with external tools
node_modules - node-js modules
We widely use the composer to manage dependents libraries, NodeJS runtime for Javascript code processing.
In MikoPBXUtils dir create file babel.config.json
:
In MikoPBXUtils dir create file package.json
:
Install all from package.json file
Use GIT command to make similar to picture folder sctructure with MikoPBX sources.
Install third party PHP libraries to MikoPBX/Core folder
Every MikoPBX module must have a unique identifier, i.e. you are developing a call back module with the identifier – ModuleYourModule
We advise using PHPStorm IDE because all MikoPBX code was written with this tool.
Create a new PHP empty Project from existing sources.
Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments.
Babel guarantees that the JS code will work the same in all web browsers.
The source JS files are located in directories:
MikoPBX/Core/sites/admin-cabinet/assets/js/src
MikoPBX/Extensions/*/public/assets/js/src
Files that the web interface uses are located in directories:
MikoPBX/Core/sites/admin-cabinet/assets/js/pbx
MikoPBX/Extensions/*/public/assets/js
With any modification of the source file, babel must create a final file.
Go to Settings / Tools / File Watchers
Click to "Add" button
Choose template "Babel"
Set "Name" - Babel Core
Set "Program" $ProjectFileDir$\MikoPBXUtils\node_modules\.bin\babel
Set "Arguments" $FilePath$ --out-dir $FileParentDir$/../pbx/$FileDirName$ --source-maps inline --presets airbnb
Set "Output path to refresh": $FileParentDir$/../pbx/$FileDirName$/$FileprNameWithoutExtension$.js:$FileParentDir$/../pbx/$FileDirName$/$FileNameWithoutExtension$.js.map
Set "Auto-save edited files to trigger the watcher"
Set "Trigger the watcher on external changes"
Set "Working directory": $ProjectFileDir$\MikoPBXUtils
Setup "Scope"
Set "Name" - Project Core
Set "Pattern": file:Core/sites/admin-cabinet/assets/js/src/*.js
Go to Settings / Tools / File Watchers
Click to "Add" button
Choose template "Babel"
Set "Name" - Babel Modules
Set "Program" $ProjectFileDir$\MikoPBXUtils\node_modules\.bin\babel
Set "Arguments" $FilePath$ --out-dir $FileParentDir$ --source-maps inline --presets airbnb
Set "Output path to refresh": $FileParentDir$\$FileNameWithoutExtension$.js:$FileParentDir$\$FileNameWithoutExtension$.js.map
Set "Auto-save edited files to trigger the watcher"
Set "Trigger the watcher on external changes"
Set "Working directory": $ProjectFileDir$\MikoPBXUtils
Setup "Scope"
Set "Name" - Project Modules
Set "Pattern":file:Extensions/*/public/assets/js/src/*.js
Go to Settings / Plugins
Search "Phalcon" and install it
To create a new module for MikoPBX, you can use the repository as ready for use template.
Сopy the script to the Extensions dir and run it. It clones the ModuleTemplate repository and renames folders, files, namespaces and class names according to the new module unique id – ModuleYourModule.
You have to download it by the next and install it.
Setup the composer executable path according to this .
Setup the PHP interpreter path according to this .