brendt/php-sparkline
brendt/php-sparkline has 350 GitHub stars and 12 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-21 06:20 UTC. Last push 2025-10-09.
实测星标增长
- 24小时
- 0
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
Generate GitHub style sparkline graphs with PHP
开发工具README.md
原文Generate sparkline SVGs in PHP
PHP-Sparkline generates GitHub style sparkline graphs. Read this guide to know how to use it.
Installation
You can install the package via composer:
composer require brendt/php-sparkline
Usage
$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.
Customization
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);

Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.