FreePBX Hello World with BMO for 15+. Note: Some functionality may work on versions 12-14, though deprecated methods have been removed.
This module is fully functional for managing notes. It installs successfully on FreePBX 13 and utilizes features exclusive to version 15, such as backup and restore.
This module aims to strike a balance between demonstrating key functionality and avoiding overwhelming complexity. The following tasks are covered:
- Basic Structure
- Writing to Database
- Reading from Database
- Writing a Configuration File
- Reading a Configuration File
- Displaying a Page
- Displaying a Populated Form
- Handling Form Submission
- Writing Dial Plan
The UCP module may have its own scope and readme file, as it's not the primary focus of this example.
- Hook into pages.
- Implement creation/editing of a configuration file.
- Comment and clarify code.
-
rawname
- assets
- js
- css
- views
- assets
-
UCP (Optional)
- assets
- js
- css
- views
- assets
-
Api
- Rest
- Graphql
assets
: Contains CSS and JavaScript files.views
: HTML page views, devoid of logic.
Optional module for the user control panel, following the same directory structure as rawname
.
rawname/Rawname.class.php
: Primary module class.rawname/module.xml
: Module definition.rawname/rawname.page.php
Follow the convention of capitalizing the first letter.
These methods are mandatory, even if not utilized:
public function install() {}
public function uninstall() {}
public function doConfigPageInit(\$page) {}
Replaces install.php
.
Performs cleanup tasks.
Generates an array for potential restoration.
Accepts the array generated by the backup method for restoring previous configurations.
Essential for processing $_REQUEST
.
Avoid using ?>
followed by an empty newline, as PHP may encounter issues. Only use ?>
for inline PHP.
- Uniformity Guidelines: FreePBX Wiki
- Code Snippets: GitHub - FreePBX-gists
If you found this code helpful, consider supporting my employer, as it enables me to continue developing such projects.
AGPLv3+