DbFace allows you creating your own API by PHP for public access. DbFace use CodeIgniter Framework to provide a flexible PHP development environment.

Create or edit Cloud code#

  • Sign in DbFace with Administrator or Developer account
  • Tap "Settings" -> "Cloud Code"

You will see all available cloud code you already created in the selected database connection.

Cloud code list page

Tap the "Create API Code" button to create a new API code.

Cloud code list page

  • API Name: this will be the Public URL for accessing the cloud
  • Disabled: if you want disable the public URL temporarily, you can check the "Disable" checkbox
  • Open: open the cloud code in debug mode
  • Save Changes: after editing the cloud code, do not forget click "Save Changes" button to save the cloud code

Access Cloud Code#

You will find the cloud code public URL in the list page.

Get Cloud code public URL

Cloud Code Alerts#

Cloud Code Alerts can be configured to run either on an interval or at a scheduled time.

To run a Cloud Code Alert on an interval, select the interval option and choose from every 10 minutes, 30 minutes, 1 hours, 4 hours, 12 hours, or 24 hours. Run cloud code alert on an interval

By selecting the ‘Schedule’ option, cloud code alerts can be set to run at a specific time in specific timezone.
Run cloud code alert on an schedule You can change the timezone at config/config.inc.php file

$config['crontab_schedule_timezone'] = date_default_timezone_get();

You can find all the available timezone here.

Enable Cloud Code Alerts#

You need to enable crontab to enable Cloud Code Alerts feature.

php index.php crontab crontab_key

The crontab_key can be found in config/config.inc.php

$config['crontab_execution_key'] = '6193rW3iTjXo7N3S27t2I2GA6OJjo03S';

Please modify the default crontab_execution_key, or other people can invoke the crontab if they know your dbface installation URL.

We recommend you run the cron application every 10 minutes.

sudo crontab -e

add

*/10 * * * * php /var/www/dbface/index.php cron 6193rW3iTjXo7N3S27t2I2GA6OJjo03S

Disabling Cloud Code Alerts#

Cloud Code Alerts can be disabled by turning off the "Enable Alerts" switch under the Cloud Code footer.
Disable cloud code alert

Please Notice

Cloud Code only be available on On-premises installation or Enterprise plan.

Templates#

You can also create your own Smarty templates that can be used in Cloud Code or PHP Report. Create templates

Please Notice

Use {$ and } in templates. We already put predefined variables, parameters and other global variables into the smarty instance.

Use templates in Cloud Codes#

We already create $smarty variable and put all available variables into the smarty instance. You can also use $db variable that point to your current database connection.

$smarty->display('my-template.tpl');

Use templates in PHP reports#

$smarty->display('my-template.tpl');