This example shows how to save a report template on the PHP server side in the HTML Designer. For this, you need to add the onSaveReport() event handler:
designer.onSaveReport = function (event) {
	<?php StiHelper::createHandler(); ?>

On the PHP server side you need to save the JSON report template object, passed from the Designer. This should be done in the $handler->onSaveReport event in the handler.php file. For example, this code saves the report template to the JSON text file in the 'reports' folder:
$handler->onSaveReport = function ($event) {
	$report = $event->report; // Report JSON object
	$fileName = $event->fileName; // Report file name
	file_put_contents('reports/'.$fileName.".mrt", json_encode($report));
	return StiResult::success("Save Report OK: ".$fileName);

In the screenshot below you can see the result of the sample code:

Save Report on the Server Side