{"id":25176006,"url":"https://github.com/bbsnly/chartjs-php","last_synced_at":"2025-04-07T08:16:59.650Z","repository":{"id":48529287,"uuid":"97396987","full_name":"bbsnly/chartjs-php","owner":"bbsnly","description":"PHP wrapper for Chart.js library","archived":false,"fork":false,"pushed_at":"2025-01-28T11:09:10.000Z","size":186,"stargazers_count":26,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T07:04:52.987Z","etag":null,"topics":["analytics","chart-generation","chart-library","chartjs","charts","data-visualization","graphs","php","php-library","php-wrapper","statistics"],"latest_commit_sha":null,"homepage":"https://github.com/bbsnly/chartjs-php","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbsnly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-16T16:46:51.000Z","updated_at":"2025-03-05T22:12:11.000Z","dependencies_parsed_at":"2024-01-01T23:27:48.227Z","dependency_job_id":"108ed1c7-2da0-4af6-b37d-9bd283b965df","html_url":"https://github.com/bbsnly/chartjs-php","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":0.06976744186046513,"last_synced_commit":"b0a5a1d9ddd3fbe3700179a9672e074fa2f030a2"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbsnly%2Fchartjs-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbsnly%2Fchartjs-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbsnly%2Fchartjs-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbsnly%2Fchartjs-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbsnly","download_url":"https://codeload.github.com/bbsnly/chartjs-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615382,"owners_count":20967184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","chart-generation","chart-library","chartjs","charts","data-visualization","graphs","php","php-library","php-wrapper","statistics"],"created_at":"2025-02-09T13:15:39.478Z","updated_at":"2025-04-07T08:16:59.632Z","avatar_url":"https://github.com/bbsnly.png","language":"PHP","readme":"# ChartJS-PHP\n\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n[![Tests](https://github.com/bbsnly/chartjs-php/actions/workflows/php.yml/badge.svg)](https://github.com/bbsnly/chartjs-php/actions)\n[![codecov](https://codecov.io/gh/bbsnly/chartjs-php/graph/badge.svg?token=MTIBNP8BDT)](https://codecov.io/gh/bbsnly/chartjs-php)\n[![Total Downloads](https://poser.pugx.org/bbsnly/chartjs-php/d/total.svg)](https://packagist.org/packages/bbsnly/chartjs-php)\n[![Latest Stable Version](https://poser.pugx.org/bbsnly/chartjs-php/v/stable.svg)](https://packagist.org/packages/bbsnly/chartjs-php)\n[![License](https://poser.pugx.org/bbsnly/chartjs-php/license.svg)](https://packagist.org/packages/bbsnly/chartjs-php)\n\nThis package transforms how you create [ChartJS](https://www.chartjs.org/ \"ChartJS\") elements by bringing them directly into PHP.\n\nChartJS-PHP eliminates the complexity of JavaScript when working with [ChartJS](https://www.chartjs.org/ \"ChartJS\") charts. While [ChartJS](https://www.chartjs.org/ \"ChartJS\") traditionally requires JavaScript implementation, our PHP solution delivers the same powerful charts through clean, efficient PHP code. By generating [ChartJS](https://www.chartjs.org/ \"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.\n\n**Note: Include the ChartJS library in your project as specified in their [official documentation](\u003chttps://www.chartjs.org/docs/latest/getting-started/\u003e).**\n\n## Installation\n\nInstalling ChartJS-PHP is straightforward with [Composer](https://getcomposer.org/). Run this command in your project directory:\n\n```shell\ncomposer require bbsnly/chartjs-php\n```\n\nMinimum Requirements:\n\n- PHP version: 8.1 or higher\n- ChartJS version: 2.0 or higher\n\n## Usage\n\nCreating 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.\n\nChoose from our specialized chart classes for even faster development: `BarChart`, `BubbleChart`, `DoughnutChart`, `LineChart`, `PieChart`, `PolarAreaChart`, `RadarChart`, and `ScatterChart`.\n\nHere's how to create a line chart:\n\n```php\nuse Bbsnly\\ChartJs\\Chart;\nuse Bbsnly\\ChartJs\\Config\\Data;\nuse Bbsnly\\ChartJs\\Config\\Dataset;\nuse Bbsnly\\ChartJs\\Config\\Options;\n\n$chart = new Chart;\n$chart-\u003etype = 'line';\n\n$data = new Data();\n$data-\u003elabels = ['Red', 'Green', 'Blue'];\n\n$dataset = new Dataset();\n$dataset-\u003edata = [5, 10, 20];\n$data-\u003edatasets[] = $dataset;\n\n$chart-\u003edata($data);\n\n$options = new Options();\n$options-\u003eresponsive = true;\n$chart-\u003eoptions($options);\n\n$chart-\u003eget(); // Returns the array of chart data\n$chart-\u003etoJson(); // Returns the JSON representation of the chart data\n$chart-\u003etoHtml('my_chart'); // Returns the HTML and JavaScript code for the chart\n```\n\n---\n\nIn the example below we will use the `toHtml` method to generate the HTML and JavaScript code for the chart.\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/chart.js\"\u003e\u003c/script\u003e\n\n\u003cdiv\u003e\n    \u003c?= $chart-\u003etoHtml('my_chart'); ?\u003e\n\u003c/div\u003e\n```\n\n---\n\nIn the example below we will use the `toJson` method to generate the JSON representation of the chart data.\n\n```html\n\u003cdiv\u003e\n  \u003ccanvas id=\"myChart\"\u003e\u003c/canvas\u003e\n\u003c/div\u003e\n\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/chart.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  const ctx = document.getElementById('myChart');\n\n  new Chart(ctx, \u003c?= $chart-\u003etoJson(); ?\u003e);\n\u003c/script\u003e\n```\n\n## Tests\n\nRun the test suite with:\n\n```shell\ncomposer test\n```\n\n## Contributing\n\nRead our [Contributing](CONTRIBUTING.md) guidelines and start improving ChartJS-PHP today.\n\n## License\n\nThe ChartJS PHP is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbsnly%2Fchartjs-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbsnly%2Fchartjs-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbsnly%2Fchartjs-php/lists"}