PHPackages                             mapescador/chartjs-bundle - 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. mapescador/chartjs-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

mapescador/chartjs-bundle
=========================

build awesome charts directly from your ORM Entities

2.0.7(11mo ago)020↓100%MITPHPPHP ^8

Since Jun 1Pushed 11mo agoCompare

[ Source](https://github.com/mpescadorsantirso/MukadiChartJSBundle)[ Packagist](https://packagist.org/packages/mapescador/chartjs-bundle)[ RSS](/packages/mapescador-chartjs-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (14)Used By (0)

Mukadi ChartJs Bundle
=====================

[](#mukadi-chartjs-bundle)

Build awesome charts directly from ORM Entities, using `MukadiChartJsBundle` to create high quality chart mapped directly to your data model. `MukadiChartJsBundle` is an adaptation of the [mukadi/chartjs-builder](https://github.com/mbo2olivier/mukadi-chartjs-builder) package for symfony, Here are some provided features:

- a service for build chart from DQL queries
- a service for build chart from Native SQL queries
- a Twig extension for render chart in the view

Installation
------------

[](#installation)

Install the bundle via composer by running the following command:

`php composer.phar require mukadi/chartjs-bundle`

And run `php bin/console assets:install` for installing assets in the public web directory

Chart builder
-------------

[](#chart-builder)

The bundle provide two chart builders as service:

*service**class**description*mukadi\_chart\_js.dqlMukadi\\ChartJSBundle\\Chart\\BuilderFor building chart from a DQL querymukadi\_chart\_js.nativeMukadi\\ChartJSBundle\\Chart\\NativeBuilderFor building chart from a native SQL queryYou can use chart builders like any other symfony service:

```
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Mukadi\Chart\Utils\RandomColorFactory;
use Mukadi\ChartJSBundle\Chart\Builder
use Mukadi\Chart\Chart;

class AppController extends Controller{

    public function chart(Builder $builder) {
        $builder
            ->query('SELECT COUNT(*) total, p.type FROM \App\Entity\Post p GROUP BY p.type')
            ->addDataset('total','Total',[
                "backgroundColor" => RandomColorFactory::getRandomRGBAColors(6)
            ])
            ->labels('type')
        ;

        $chart = $builder->buildChart('my_chart',Chart::PIE);
        return $this->render('chart.html.twig',[
            "chart" => $chart,
        ]);
    }
}
```

You can also pass a Doctrine\\ORM\\Query object instead of a DQL query. This allow you to use a repository to store your charts queries.

```
    ...
    $query = $this->getDoctrine()->getManager()->createQuery('SELECT COUNT(*) total, p.type FROM \App\Entity\Post p GROUP BY p.type');

    $builder
            ->query($query)
            ->addDataset('total','Total',[
                "backgroundColor" => RandomColorFactory::getRandomRGBAColors(6)
            ])
            ->labels('type')
        ;
...
```

Please, see the [mukadi/chartjs-builder documentation](https://github.com/mbo2olivier/mukadi-chartjs-builder) if you want to learn more about chart construction.

Render chart in twig template
-----------------------------

[](#render-chart-in-twig-template)

In twig template use the dedicated function for chart rendering:

```
{{ mukadi_chart(chart) }}
```

Don't forget to include libraries in your page:

```

```

And that's all !

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance54

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~244 days

Recently: every ~302 days

Total

13

Last Release

338d ago

Major Versions

0.0.2 → 1.0.02018-07-21

1.0.2 → 2.0.02020-11-13

PHP version history (6 changes)0.0.1PHP &gt;=5.3.7

1.0.0PHP &gt;=5.4

2.0.0PHP ^7.1.3

2.0.1PHP ^7.1.3||^8.0

2.0.4PHP ^8.3

2.0.5PHP ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/3663391ef7663ead7709e934986e156b565720283a2b4a629150fb155bb5d4f8?d=identicon)[mpescadorsantirso](/maintainers/mpescadorsantirso)

---

Top Contributors

[![mbo2olivier](https://avatars.githubusercontent.com/u/6231735?v=4)](https://github.com/mbo2olivier "mbo2olivier (15 commits)")[![mpescadorsantirso](https://avatars.githubusercontent.com/u/44074790?v=4)](https://github.com/mpescadorsantirso "mpescadorsantirso (15 commits)")[![psyray](https://avatars.githubusercontent.com/u/1230954?v=4)](https://github.com/psyray "psyray (2 commits)")

---

Tags

graphicschartjsSymfony BundlechartsChart builder

### Embed Badge

![Health badge](/badges/mapescador-chartjs-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mapescador-chartjs-bundle/health.svg)](https://phpackages.com/packages/mapescador-chartjs-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)

PHPackages © 2026

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