#Dynamic Inset PHP renderer ##A reference renderer for insets, in php
This php library is a reference implementation of a renderer for the inset.json spec.
The library takes a remote inset.json file, finds the data and template urls, requests them, and returns the rendered result. The individual assets are available after rendering for access or post-processing as well.
##Note: This library uses the mustache.php renderer, embedded in this repo for the time being. It will later be replaced by a Composer-compatible package.
###PHP library
<?php
//include the inset rendering library
require('lib/inset.php');
//create a new inset
$inset = new inset();
//render the inset
$rendered_inset = $inset->render('http://dynamic-insets.s3.amazonaws.com/example/inset.json');
//output the inset
echo $rendered_inset;
###Example of inset.json
{
"status": "OK",
"type": "InsetDynamic",
"platforms": [
"desktop",
"mobile"
],
"serverside": {
"data": {
"url": "http://dynamic-insets.s3.amazonaws.com/example/data.json"
},
"template": {
"url": "http://dynamic-insets.s3.amazonaws.com/example/template.mu"
}
}
}