PHPackages                             mikuspetr/charts-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mikuspetr/charts-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mikuspetr/charts-php
====================

PHP library to buid charts with Chart.js

v1.0.5(3y ago)130MITPHPPHP &gt;=7.1.0

Since Mar 31Pushed 3y ago2 watchersCompare

[ Source](https://github.com/mikuspetr/charts-php)[ Packagist](https://packagist.org/packages/mikuspetr/charts-php)[ RSS](/packages/mikuspetr-charts-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (8)Used By (0)

**ChartsPhp** is a library that makes an interface between JavaScript library **Chart.js** and **PHP**. You can draw charts directly from PHP.

Prerequisites
-------------

[](#prerequisites)

- Chart.js - install Chart.js by NPM, CDN, ... [Installation instructions](https://www.chartjs.org/docs/latest/getting-started/installation.html)
- Composer - you can download from [getcomposer.org](http://getcomposer.org).

Install ChartsPhp by composer
-----------------------------

[](#install-chartsphp-by-composer)

```
composer require mikuspetr/charts-php

```

Exaple
------

[](#exaple)

```
use ChartsPhp\ChartsPhp;

$chartType = 'bar';

// The arrays structure copies data object structure in Chart.js
$labels = ['January', 'February', 'March', 'April', 'May', 'June',];
$datasets = [
    [
        'label' => 'apples',
        'data' => [10, 12, 8, 25, 32, 20]
    ],
    [
        'label' => 'bananas',
        'data' => [11, 4, 15, 17, 10, 23]
    ]
];
$options = ['aspectRatio' => 3];

// use constructor to create new chart
$barChart = ChartsPhp::createChart($chartType, $labels, $datasets, $options);

// render HTML canvas
echo $barChart->renderHtml();

// render JavaScript that draw chart in canvas (require Chart.js)
echo $barChart->renderScript();

// use add methods to create new chart
$lineChart = ChartsPhp::createChart('line')
    ->setLabels($labels)
    ->addDatasets($datasets)
    ->setOptions(['aspectRatio' => 4, 'cubicInterpolationMode' => 'monotone']);

// render both, HTML and JavaScript
echo $lineChart;
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~17 days

Total

7

Last Release

1434d ago

Major Versions

v0.1.0 → v1.0.02022-03-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/0952e98200a8834566f2dc8760bb342097aa98935905f8aab76a12c371738045?d=identicon)[mikuspetr](/maintainers/mikuspetr)

---

Top Contributors

[![mikuspetr](https://avatars.githubusercontent.com/u/80406921?v=4)](https://github.com/mikuspetr "mikuspetr (15 commits)")

### Embed Badge

![Health badge](/badges/mikuspetr-charts-php/health.svg)

```
[![Health](https://phpackages.com/badges/mikuspetr-charts-php/health.svg)](https://phpackages.com/packages/mikuspetr-charts-php)
```

###  Alternatives

[andrefigueira/blog-article-faker

Generate random blog article titles and content (including markdown) using faker

1415.0k](/packages/andrefigueira-blog-article-faker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
