The code of Server Connect is very easy to extend, you could create your own formatters or modules. Problem is that the custom code is not recognized by Wappler, so you are not able to use them from the UI in Wappler, you have to add it all manually.
There were already some posts here in the forum with custom formatters for PHP.
Here a sample of how a module would become:
<?php
namespace modules;
use \lib\core\Module;
use \lib\core\Path;
// class should extend Module
class xml extends Module
{
// all public function will be available as actions
// parameters are always $options and $name
// $options will contain the options for the action
// $name is the name of the action
public function import($options, $name) {
// parseObject will parse all expressions it finds in options
$options = $this->app->parseObject($options);
// for the example I keep it simple, a better xml to json can be found at
// https://outlandish.com/blog/tutorial/xml-to-json/
// Path::toSystemPath is a helper method to convert the path selected in Wappler to a system path
return simplexml_load_file(Path::toSystemPath($options->path), 'SimpleXMLElement', LIBXML_NOWARNING);
}
}
save the file as xml.php
in the dmxConnectLib/modules
folder.
Your action file from Wappler contains a json that describes the actions it should run.
calling the above custom module step will look like:
{
"name": "myImport",
"module": "xml",
"action": "import",
"output": true,
"options": {
"path": "/data.xml"
}
},
name
: property name for the output, will also be given to the action method as parameter
module
: name of the module (filename and classname should be names so)
action
: name of the method to call from the module
output
: should the result be added to the output json
options
: options passed to the action method
Please be aware that you have to edit it by hand, there is no support for it within Wappler. Also I can’t promise that Wappler would not overwrite your code, so better have a backup of it. And you will need enough PHP knowledge to code your own modules.