Download the PHP package tito10047/php-sparkline without Composer
On this page you can find all versions of the php package tito10047/php-sparkline. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tito10047/php-sparkline
More information about tito10047/php-sparkline
Files in tito10047/php-sparkline
Package php-sparkline
Short Description Generate sparkline SVGs in PHP
License MIT
Homepage https://github.com/brendt/php-sparkline
Informations about the package php-sparkline
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:
Usage
To construct a sparkline, you'll have to pass in a collection of Brendt\SparkLineDay
objects. This object takes two parameters: a count
, and a DateTimeInterface
. You could for example convert database entries like so:
In many cases though, you'll want to aggregate data with an SQL query, and convert those aggregations on the fly to SparkLineDay
objects:
Precision
Make precision for 5 minute intervals
Customization
This package offers some methods to customize the sparkline. First off, you can pick any amount of colors and the sparkline will automatically generate a gradient from them:
Next, you can configure a bunch of numbers:
withStrokeWidth
will determine the stroke's widthwithDimensions
will determine the width and height of the rendered SVGwithMaxItemAmount
will determine how many days will be shown. If you originally passed on more days than this max, then the oldest ones will be omitted. If the max amount is set to a number that's higher than the current amount of days, then the sparkline will contain empty days. By default, the amount of given days will be used.withMaxValue
will set the maximum value of the sparkline. This is useful if you have multiple sparklines that should all have the same scale. By default, the maximum value is determined based on the given days.
Testing
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
- Brent Roose
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of php-sparkline with dependencies
illuminate/collections Version ^9.43|^10.0|^11.0
ramsey/uuid Version ^4.6
spatie/period Version ^2.3