PHP code example of fidelize / flowchart-to-png
1. Go to this page and download the library: Download fidelize/flowchart-to-png library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fidelize / flowchart-to-png example snippets
$json = '{
"nodes": [
{
"id": "flowchartStart",
"type": "start",
"text": "Start",
"left": "20px",
"top": "180px",
"countSource": null
},
{
"id": "flowchartEnd",
"type": "end",
"text": "End",
"left": "940px",
"top": "180px",
"countSource": null
},
{
"id": "flowchartWindow1489779664638",
"type": "action",
"text": "Approve",
"left": "680px",
"top": "260px",
"action": "Approve",
"extraParams": "",
"countSource": "1"
},
{
"id": "flowchartWindow1489779672763",
"type": "action",
"text": "Reject",
"left": "620px",
"top": "40px",
"action": "Reject",
"extraParams": "",
"countSource": "1"
}
],
"edges": [
{
"source": "flowchartStart",
"target": "flowchartWindow1489779664638",
"data": {
"label": "",
"positionSource": "RightMiddle",
"positionTarget": "LeftMiddle"
}
},
{
"source": "flowchartStart",
"target": "flowchartWindow1489779672763",
"data": {
"label": "",
"positionSource": "RightMiddle",
"positionTarget": "LeftMiddle"
}
},
{
"source": "flowchartWindow1489779672763",
"target": "flowchartEnd",
"data": {
"label": "Success",
"return": "success",
"positionSource": "RightMiddle",
"positionTarget": "LeftMiddle"
}
},
{
"source": "flowchartWindow1489779664638",
"target": "flowchartEnd",
"data": {
"label": "Success",
"return": "success",
"positionSource": "RightMiddle",
"positionTarget": "LeftMiddle"
}
}
]
}';
$flowChartImage = new FlowChartImage();
$flowChartImage->setContent($json);
$flowChartImage->generate()->toPng($path);
bash
$ php composer.phar install