FreePBX Internals

What does Internal Mean?

Internal means any program that tries to access parts of FreePBX as a module that is found inside the admin/modules folder. 

For now please checkout out development module located at: https://github.com/FreePBX/helloworld

 

Creating a BMO Module

Create a file called Modulename.class.php in the root of your module directory.  In this example we're creating a pony module, and we're going to call it ponies

To start with, the file /var/www/html/admin/modules/ponies/Ponies.class.php must contain at least:

<?php // Ensure you namespace your module. Failing to do so may lead to unexpected bugs. namespace FreePBX\modules;    class Ponies implements \BMO {     public function install() {}     public function uninstall() {}     public function backup() {}     public function restore($backup) {}     public function doConfigPageInit($page) {} }

 

You also need to create a 'module.xml' file that contains the definition of the Module (See module.xml)

The 'FreePBX_Helpers' class is built in BMO.interface.php, and provides Autoloading of classes, the ability to use $this->getConfig() and $this->setConfig() - the new built in high-performance key/value store, and the management and mitigation of $_REQUEST responses. 

Note that this by itself is not useful at all, and will in fact cause an error to be displayed, because it doesn't contain the public function 'doConfigPageInit()', which, while is not required by the BMO interface, is required by the Hooks class. See the BMO Hooks page for more information.

 

 

 

 

 

External libraries available for use in Framework

Please note some of these may be abstracted out into BMO functions. It is recommended that you use the BMO functions where available.

Return to Documentation Home I Return to Sangoma Support