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

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

mukadi/chartjs-bundle
=====================

build awesome charts directly from your ORM Entities

3.2.1(1y ago)49.5k61MITPHPPHP &gt;=8.0CI failing

Since Jun 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mbo2olivier/MukadiChartJSBundle)[ Packagist](https://packagist.org/packages/mukadi/chartjs-bundle)[ RSS](/packages/mukadi-chartjs-bundle/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (5)Versions (13)Used By (1)

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 and 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 Factory
-------------

[](#chart-factory)

The bundle provide the `Mukadi\ChartJSBundle\Factory\ChartFactory` service (or `@mukadi.chart.factory` if you are not using autowiring):

You can use chart factory like any other symfony service:

```
namespace App\Controller;

use App\Chart\VideoGame;
use Mukadi\ChartJSBundle\Factory\ChartFactory;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class AppController extends AbstractController{

    #[Route('/', name: 'app_app')]
    public function index(ChartFactory $factory): Response {
        $chart = $factory
                ->withDql() # if you plan to use DQL query
                ->createChartBuilder()
                ->asBar()
                    ->query("SELECT COUNT(j) total, AVG(j.prix) prix, j.console console FROM \App\Entity\VideoGame j group by j.console")
                    ->labels('console')
                    ->dataset("Prix moyen")
                        ->data('prix')->useRandomBackgroundColor()
                    ->end()
                    ->dataset("Nombre")
                        ->data('total')->useRandomBackgroundColor()
                    ->end()
                ->build()
                ->getChart()
                ;

        $chart2 = $factory
                ->withNativeSql() # if you gonna use native SQL query
                ->createChartBuilder()
                ->asBar()
                    ->query("SELECT COUNT(*) total, AVG(prix) prix, console FROM jeux_video GROUP BY console")
                    ->labels('console')
                    ->dataset("Prix moyen")
                        ->data('prix')->useRandomBackgroundColor()
                    ->end()
                    ->dataset("Nombre")
                        ->data('total')->useRandomBackgroundColor()
                    ->end()
                ->build()
                ->getChart()
                ;

        return $this->render('app/index.html.twig', [
            'chart' => $chart,
            'chart2' => $chart2,
        ]);
    }
}
```

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 !

Use chart definitions
---------------------

[](#use-chart-definitions)

The Charts definition is an elegant way to build your charts in separate classes, so you get a more readable code and also reusable charts (a very powerful feature when combining with parametrized query). Read more about chart definition in the core [mukadi/chartjs-builder](https://github.com/mbo2olivier/mukadi-chartjs-builder) library.

Create your chart by implementing the `Mukadi\Chart\ChartDefinitionInterface` interface:

```
namespace App\Chart;

use Mukadi\Chart\ChartDefinitionBuilderInterface;
use Mukadi\Chart\ChartDefinitionInterface;

class VideoGameChart implements ChartDefinitionInterface {

    public function define(ChartDefinitionBuilderInterface $builder): void
    {
        $sql = "SELECT COUNT(*) total, AVG(prix) prix, console FROM jeux_video WHERE possesseur = :possesseur GROUP BY console";

        $builder
            ->asPolarArea()
            ->query($sql)
            ->labels('console')
            ->dataset("Total")
                ->data('total')->useRandomBackgroundColor()
            ->end()
            ->dataset("Prix moyen")
                ->data('prix')->useRandomBackgroundColor()
            ->end()
        ;
    }
}
```

In your controller you only have to write this:

```
 $chart = $factory
                ->withNativeSql()
                ->createFromDefinition(VideoGameChart::class)
                ->setParameter(':possesseur', 'Michel')
                ->getChart()
                ;
```

Note: you can use the FCQN of the chart definition only if the class is managed by the DI component, if you are using the standard symfony `services.yml` file so it's automatically handled for you, if you don't you must do it by yourself.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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 ~242 days

Recently: every ~140 days

Total

12

Last Release

656d ago

Major Versions

0.0.2 → 1.0.02018-07-21

1.0.2 → 2.0.02020-11-13

2.x-dev → 3.0.02023-03-02

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

1.0.0PHP &gt;=5.4

2.0.0PHP ^7.1.3

3.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6231735?v=4)[Olivier M. Mukadi](/maintainers/mbo2olivier)[@mbo2olivier](https://github.com/mbo2olivier)

---

Top Contributors

[![mbo2olivier](https://avatars.githubusercontent.com/u/6231735?v=4)](https://github.com/mbo2olivier "mbo2olivier (20 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/mukadi-chartjs-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[sulu/sulu

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

1.3k1.4M196](/packages/sulu-sulu)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k58](/packages/open-dxp-opendxp)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

939.0k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

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