1. Go to this page and download the library: Download tito10047/php-sparkline 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/ */
tito10047 / php-sparkline example snippets
$sparkLine = SparkLine::new(collect([
new SparkLineDay(
count: 1,
day: new DateTimeImmutable('2022-01-01')
),
new SparkLineDay(
count: 2,
day: new DateTimeImmutable('2022-01-02')
),
// …
]));
$total = $sparkLine->getTotal();
$period = $sparkLine->getPeriod(); // Spatie\Period
$svg = $sparkLine->make();