1. Go to this page and download the library: Download fundevogel/tiny-phpeanuts 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/ */
fundevogel / tiny-phpeanuts example snippets
undevogel\Donut;
$donut = new Donut(
[
['color' => '#4F5D95', 'value' => 0.68], # PHP
['color' => '#2b7489', 'value' => 0.25], # TypeScript
['color' => '#563d7c', 'value' => 0.04], # CSS
['color' => '#3572A5', 'value' => 0.02], # Python
['color' => '#89e051', 'value' => 0.01], # Shell
]
);
// .. maybe make it a pie chart?
$donut->setPieChart(true);
// Render its markup
$svg = $donut->render();
# Save it to disk ..
# (1) .. using the XML DOM parser
$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($svg);
$dom->save('dist/chart_xml-dom-parser.svg');
# (2) .. echoing its contents
header('Content-Type: image/svg+xml');
echo $svg;
# (3) .. or simply like this
file_put_contents('dist/chart_file-put-contents.svg', $svg);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.