https://github.com/bbsnly/chartjs-php
PHP wrapper for Chart.js library
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
PHP wrapper for Chart.js library
Basic Info
- Host: GitHub
- Owner: bbsnly
- License: mit
- Language: PHP
- Default Branch: main
- Homepage: https://github.com/bbsnly/chartjs-php
- Size: 182 KB
Statistics
- Stars: 27
- Watchers: 4
- Forks: 7
- Open Issues: 1
- Releases: 13
Topics
Metadata Files
README.md
ChartJS-PHP
This package transforms how you create ChartJS elements by bringing them directly into PHP.
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.
Note: Include the ChartJS library in your project as specified in their official documentation.
Installation
Installing ChartJS-PHP is straightforward with Composer. Run this command in your project directory:
shell
composer require bbsnly/chartjs-php
Minimum Requirements:
- 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.
Choose from our specialized chart classes for even faster development: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, and ScatterChart.
Here's how to create a line chart:
```php 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.
```html
```
In the example below we will use the toJson method to generate the JSON representation of the chart data.
```html
```
Tests
Run the test suite with:
shell
composer test
Contributing
Read our Contributing guidelines and start improving ChartJS-PHP today.
License
The ChartJS PHP is open-sourced software licensed under the MIT license.
Owner
- Name: Anatoliy Babushka
- Login: bbsnly
- Kind: user
- Repositories: 3
- Profile: https://github.com/bbsnly
GitHub Events
Total
- Issues event: 3
- Watch event: 4
- Delete event: 5
- Issue comment event: 12
- Push event: 19
- Pull request event: 7
- Fork event: 2
- Create event: 5
Last Year
- Issues event: 3
- Watch event: 4
- Delete event: 5
- Issue comment event: 12
- Push event: 19
- Pull request event: 7
- Fork event: 2
- Create event: 5
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Anatoliy Babushka | a****a@g****m | 83 |
| dependabot[bot] | 4****] | 33 |
| Tom Schenk | T****k | 1 |
| Anatoliy Babushka | a****a@u****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 6
- Total pull requests: 40
- Average time to close issues: 11 months
- Average time to close pull requests: 2 days
- Total issue authors: 4
- Total pull request authors: 3
- Average comments per issue: 2.17
- Average comments per pull request: 0.75
- Merged pull requests: 35
- Bot issues: 0
- Bot pull requests: 36
Past Year
- Issues: 2
- Pull requests: 16
- Average time to close issues: 11 days
- Average time to close pull requests: about 23 hours
- Issue authors: 2
- Pull request authors: 2
- Average comments per issue: 4.5
- Average comments per pull request: 1.19
- Merged pull requests: 14
- Bot issues: 0
- Bot pull requests: 15
Top Authors
Issue Authors
- bbsnly (3)
- xcopy (1)
- TomSchenk (1)
- samtuke (1)
- paytah232 (1)
Pull Request Authors
- dependabot[bot] (61)
- bbsnly (5)
- TomSchenk (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- packagist 68,665 total
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 13
- Total maintainers: 1
packagist.org: bbsnly/chartjs-php
PHP wrapper for Chart.js library
- Homepage: https://github.com/bbsnly/chartjs-php
- License: MIT
-
Latest release: v4.0.1
published over 1 year ago
Rankings
Maintainers (1)
Funding
Dependencies
- phpunit/phpunit ^9.2 development
- php >=7.4
- doctrine/instantiator 1.4.1 development
- myclabs/deep-copy 1.11.0 development
- nikic/php-parser v4.14.0 development
- phar-io/manifest 2.0.3 development
- phar-io/version 3.2.1 development
- phpdocumentor/reflection-common 2.2.0 development
- phpdocumentor/reflection-docblock 5.3.0 development
- phpdocumentor/type-resolver 1.6.1 development
- phpspec/prophecy v1.15.0 development
- phpunit/php-code-coverage 9.2.15 development
- phpunit/php-file-iterator 3.0.6 development
- phpunit/php-invoker 3.1.1 development
- phpunit/php-text-template 2.0.4 development
- phpunit/php-timer 5.0.3 development
- phpunit/phpunit 9.5.21 development
- sebastian/cli-parser 1.0.1 development
- sebastian/code-unit 1.0.8 development
- sebastian/code-unit-reverse-lookup 2.0.3 development
- sebastian/comparator 4.0.6 development
- sebastian/complexity 2.0.2 development
- sebastian/diff 4.0.4 development
- sebastian/environment 5.1.4 development
- sebastian/exporter 4.0.4 development
- sebastian/global-state 5.0.5 development
- sebastian/lines-of-code 1.0.3 development
- sebastian/object-enumerator 4.0.4 development
- sebastian/object-reflector 2.0.4 development
- sebastian/recursion-context 4.0.4 development
- sebastian/resource-operations 3.0.3 development
- sebastian/type 3.0.0 development
- sebastian/version 3.0.2 development
- theseer/tokenizer 1.2.1 development
- webmozart/assert 1.11.0 development