{"id":21879176,"url":"https://github.com/typpo/quickchart-php","last_synced_at":"2025-07-19T12:39:03.634Z","repository":{"id":40786328,"uuid":"314871996","full_name":"typpo/quickchart-php","owner":"typpo","description":"PHP client for QuickChart chart API","archived":false,"fork":false,"pushed_at":"2024-01-16T19:12:44.000Z","size":21,"stargazers_count":40,"open_issues_count":0,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-16T21:48:53.068Z","etag":null,"topics":["chart-api","image-chart-api","php-chart"],"latest_commit_sha":null,"homepage":"https://quickchart.io/","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/typpo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2020-11-21T17:59:48.000Z","updated_at":"2025-05-15T10:09:58.000Z","dependencies_parsed_at":"2023-12-24T20:18:25.433Z","dependency_job_id":"8485e7ee-4924-46b0-bb3d-007ce892af81","html_url":"https://github.com/typpo/quickchart-php","commit_stats":{"total_commits":20,"total_committers":5,"mean_commits":4.0,"dds":"0.19999999999999996","last_synced_commit":"7493dc907f5c33606ccab982a48b29e24524d7ff"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/typpo/quickchart-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typpo","download_url":"https://codeload.github.com/typpo/quickchart-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265573697,"owners_count":23790491,"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":["chart-api","image-chart-api","php-chart"],"created_at":"2024-11-28T08:15:29.649Z","updated_at":"2025-07-19T12:39:03.617Z","avatar_url":"https://github.com/typpo.png","language":"PHP","readme":"# quickchart-php\n[![Packagist VERSION](http://img.shields.io/packagist/v/ianw/quickchart.svg?style=flat)](https://packagist.org/packages/ianw/quickchart)\n\nA PHP client for the [quickchart.io](https://quickchart.io/) chart image API.\n\n# Installation\n\nUse the `QuickChart.php` library in this project, or [install from packagist](https://packagist.org/packages/ianw/quickchart).\n\n```\ncomposer require ianw/quickchart\n```\n\n# Usage\n\nThis library provides a `QuickChart` class.  Import and instantiate it.  Then set properties on it and specify a [Chart.js](https://chartjs.org) config:\n\n```php\n$chart = new QuickChart(array(\n  'width' =\u003e 500,\n  'height' =\u003e 300\n));\n\n$chart-\u003esetConfig('{\n  type: \"bar\",\n  data: {\n    labels: [\"Hello world\", \"Test\"],\n    datasets: [{\n      label: \"Foo\",\n      data: [1, 2]\n    }]\n  }\n}');\n```\n\nUse `getUrl()` on your QuickChart object to get the encoded URL that renders your chart:\n\n```php\necho $chart-\u003egetUrl();\n// https://quickchart.io/chart?c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22Hello+world%22%2C%22Test%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Foo%22%2C%22data%22%3A%5B1%2C2%5D%7D%5D%7D%7D\u0026w=500\u0026h=300\n```\n\nIf you have a long or complicated chart, use `getShortUrl()` to get a fixed-length URL using the quickchart.io web service (note that these URLs only persist for a short time unless you have a subscription):\n\n```php\necho $chart-\u003egetShortUrl();\n// https://quickchart.io/chart/render/f-a1d3e804-dfea-442c-88b0-9801b9808401\n```\n\nThe URLs will render an image of a chart:\n\n\u003cimg src=\"https://quickchart.io/chart?c=%7B%22type%22%3A+%22bar%22%2C+%22data%22%3A+%7B%22labels%22%3A+%5B%22Hello+world%22%2C+%22Test%22%5D%2C+%22datasets%22%3A+%5B%7B%22label%22%3A+%22Foo%22%2C+%22data%22%3A+%5B1%2C+2%5D%7D%5D%7D%7D\u0026w=600\u0026h=300\u0026bkg=%23ffffff\u0026devicePixelRatio=2.0\u0026f=png\" width=\"500\" /\u003e\n\n## Creating the chart object\n\nThe `QuickChart` class constructor accepts an array containing the following keys.  All are optional and can be set after object creation:\n\n### config: array or string\nThe actual Chart.js chart configuration.\n\n### width: int\nWidth of the chart image in pixels.  Defaults to 500\n\n### height: int\nHeight of the chart image  in pixels.  Defaults to 300\n\n### format: string\nFormat of the chart. Defaults to png.\n\n### backgroundColor: string\nThe background color of the chart. Any valid HTML color works. Defaults to #ffffff (white). Also takes rgb, rgba, and hsl values.\n\n### devicePixelRatio: float\nThe device pixel ratio of the chart. This will multiply the number of pixels by the value. This is usually used for retina displays. Defaults to 1.0.\n\n### version: string\nThe Chart.js version to use.  See [documentation](https://quickchart.io/documentation/#parameters) for supported versions.\n\n### apiKey: string\nYour QuickChart API key, if you have one.\n\n## Setting properties\n\nEach option above has an associated function call that you can invoke on your `QuickChart` object:\n\n - `setConfig($config)`\n - `setWidth($width)`\n - `setHeight($height)`\n - `setFormat($format)`\n - `setBackgroundColor($backgroundColor)`\n - `setDevicePixelRatio($devicePixelRatio)`\n - `setVersion($version)`\n - `setApiKey($apiKey)`\n\n## Getting URLs\n\nThere are two ways to get a URL for your chart object.\n\n### getUrl: string\n\nReturns a URL that will display the chart image when loaded.\n\n### getShortUrl: string\n\nUses the quickchart.io web service to create a fixed-length chart URL that displays the chart image.  Returns a URL such as `https://quickchart.io/chart/render/f-a1d3e804-dfea-442c-88b0-9801b9808401`.\n\nNote that short URLs expire after a few days for users of the free service.  You can [subscribe](https://quickchart.io/pricing/) to keep them around longer.\n\n## Other outputs\n\n### toBinary: binary string\n\nReturns a binary string representing the chart image\n\n### toFile($path: string)\n\nWrite the image to a file\n\nFor example:\n```php\n$chart-\u003etoFile('/tmp/myfile.png')\n```\n\n## More examples\n\nCheckout the `examples` directory to see other usage.\n\n## Troubleshooting\n\n**PHP5 users**: This package requires curl and json modules.\n\n**sslv3 handshake alert failure**: You are using an outdated version of `curl`.  Please upgrade curl on your machine.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyppo%2Fquickchart-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyppo%2Fquickchart-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyppo%2Fquickchart-php/lists"}