It is almost always prefered to use internal functions and methods when interacting with FreePBX. This is made dificult when you don't know what those functions are. Reading the code can be tedious at times. Here is a flow to help you figure out internals.
This is provided as information only. This is a personal thing and is not supported by my employer. FreePBX is a trademark of Sangoma who also does not endorse or support this doc. While this is not an official project my employment does allow me to feed my family while giving back. Feel free to check out https://clearlyip.com . Buying from them feeds and shelters me and my offspring :)
<?php
include '/etc/freepbx.conf';
print_r(get_class_methods(FreePBX::Core()));
...
Array
(
[0] => __construct
[1] => getRightNav
[2] => getAllDrivers
[3] => getDriver
[4] => loadDrivers
[5] => getAllDriversInfo
...
In general there is a naming convention of module_foo for functions.
<?php
include '/etc/freepbx.conf';
$functions = get_defined_functions();
$localFunctions = $functions['user'];
print_r(array_filter($localFunctions , function($current){return strpos($current,'core_') === 0;}));
...
Array
(
[391] => core_destination_popovers
[392] => core_destinations
[393] => core_getdest
[394] => core_getdestinfo
[395] => core_do_get_config
[396] => core_ampusers_add
[397] => core_ampusers_del
...
You can simply print_r($localFunctions to get everything)
In both of the above you simply replace core with the module name. This does Not give you the parameters to pass. For those you can review the code but you don't have to comb through it. You can simply go to the function by name. Methods will be in Modulename.class.php and functions will be in functions.inc.php for the most part.
You may also use grep to find the function and args by name.
# grep -r "function core_getdest(" /var/www/html/admin/modules/core/*
/var/www/html/admin/modules/core/functions.inc.php:function core_getdest($exten) {
Hopefully this helps you speed up development while using FreePBX Internals.