使用 PHP 生成 GitHub 样式的火花图
PHP-Sparkline generates GitHub style sparkline graphs. Read this guide to know how to use it.
You can install the package via composer:
composer require brendt/php-sparkline$sparkLine = new SparkLine(1, 2, 5, 10, 2);
$total = $sparkLine->getTotal();
$svg = $sparkLine->make();To construct a sparkline, you'll have to pass in an array of values.
You can pick any amount of colors and the sparkline will automatically generate a gradient from them:
$sparkLine = (new SparkLine($days))->withColors('#4285F4', '#31ACF2', '#2BC9F4');You can configure the stroke width:
$sparkLine = (new SparkLine($days))->withStrokeWidth(4);As well as the dimensions (in pixels):
$sparkLine = SparkLine::new($days)->withDimensions(width: 500, height: 100);composer testPlease see CHANGELOG for more information on what has changed recently.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
暂无开放 Issues,或尚未同步最近议题。