2017 © Pedro Peláez
 

package chartjs-php

PHP library for ChartJS 2.0

image

bbsnly/chartjs-php

PHP library for ChartJS 2.0

  • Friday, June 15, 2018
  • by bbsnly
  • Repository
  • 2 Watchers
  • 5 Stars
  • 3,232 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 8 Versions
  • 23 % Grown

The README.md

ChartJS-PHP

Contributor Covenant Tests codecov Total Downloads Latest Stable Version License, (*1)

This package transforms how you create ChartJS elements by bringing them directly into PHP., (*2)

ChartJS-PHP eliminates the complexity of JavaScript when working with ChartJS charts. While ChartJS traditionally requires JavaScript implementation, our PHP solution delivers the same powerful charts through clean, efficient PHP code. By generating ChartJS elements directly in PHP, you write less code, maintain cleaner codebases, and deliver faster results. This is the definitive solution for PHP developers building data visualizations, dashboards, or any application requiring dynamic charts., (*3)

Note: Include the ChartJS library in your project as specified in their official documentation., (*4)

Installation

Installing ChartJS-PHP is straightforward with Composer. Run this command in your project directory:, (*5)

composer require bbsnly/chartjs-php

Minimum Requirements:, (*6)

  • PHP version: 8.1 or higher
  • ChartJS version: 2.0 or higher

Usage

Creating charts with ChartJS-PHP is simple and intuitive. Start by instantiating the Chart class, define your data, and render your chart. The library handles all the complexity for you., (*7)

Choose from our specialized chart classes for even faster development: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, and ScatterChart., (*8)

Here's how to create a line chart:, (*9)

use Bbsnly\ChartJs\Chart;
use Bbsnly\ChartJs\Config\Data;
use Bbsnly\ChartJs\Config\Dataset;
use Bbsnly\ChartJs\Config\Options;

$chart = new Chart;
$chart->type = 'line';

$data = new Data();
$data->labels = ['Red', 'Green', 'Blue'];

$dataset = new Dataset();
$dataset->data = [5, 10, 20];
$data->datasets[] = $dataset;

$chart->data($data);

$options = new Options();
$options->responsive = true;
$chart->options($options);

$chart->get(); // Returns the array of chart data
$chart->toJson(); // Returns the JSON representation of the chart data
$chart->toHtml('my_chart'); // Returns the HTML and JavaScript code for the chart

In the example below we will use the toHtml method to generate the HTML and JavaScript code for the chart., (*10)





= $chart->toHtml('my_chart'); ?>

In the example below we will use the toJson method to generate the JSON representation of the chart data., (*11)



Tests

Run the test suite with:, (*12)

composer test

Contributing

Read our Contributing guidelines and start improving ChartJS-PHP today., (*13)

License

The ChartJS PHP is open-sourced software licensed under the MIT license., (*14)

The Versions

15/06 2018

1.2.x-dev

1.2.9999999.9999999-dev https://github.com/bbsnly/chartjs-php

PHP library for ChartJS 2.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anatoliy Babushka

php chartjs

15/06 2018

1.2.1

1.2.1.0 https://github.com/bbsnly/chartjs-php

PHP library for ChartJS 2.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anatoliy Babushka

php chartjs

15/06 2018

dev-master

9999999-dev https://github.com/bbsnly/chartjs-php

Laravel helper for ChartJS 2.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anatoliy Babushka

laravel php chartjs

15/06 2018

2.1.1

2.1.1.0 https://github.com/bbsnly/chartjs-php

Laravel helper for ChartJS 2.0

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anatoliy Babushka

laravel php chartjs

12/10 2017

2.1.0

2.1.0.0 https://github.com/bbsnly/chartjs-php

Laravel helper for ChartJS 2.0

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Anatoliy Babushka

laravel php chartjs

12/10 2017

2.0.0

2.0.0.0 https://github.com/bbsnly/chartjs-php

Laravel helper for ChartJS 2.0

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Anatoliy Babushka

laravel php chartjs

07/08 2017

1.2.0

1.2.0.0 https://github.com/bbsnly/chartjs-php

PHP library for ChartJS 2.0

  Sources   Download

MIT

The Development Requires

by Anatoliy Babushka

php chartjs

19/07 2017

1.1.0

1.1.0.0 https://github.com/bbsnly/chartjs-php

PHP library for ChartJS 2.0

  Sources   Download

MIT

The Development Requires

by Anatoliy Babushka

php chartjs