PHPackages                             rapiddive/quickchart - 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. [Image &amp; Media](/categories/media)
4. /
5. rapiddive/quickchart

ActiveLibrary[Image &amp; Media](/categories/media)

rapiddive/quickchart
====================

QuickChart chart API

v2.0.0(3mo ago)05↓90%MITPHPPHP &gt;=5.3.0

Since Mar 26Pushed 3mo agoCompare

[ Source](https://github.com/rapiddive/quickchart-php)[ Packagist](https://packagist.org/packages/rapiddive/quickchart)[ Docs](https://github.com/rapiddive/quickchart-php)[ RSS](/packages/rapiddive-quickchart/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (3)Used By (0)

quickchart-php
==============

[](#quickchart-php)

[![Packagist VERSION](https://camo.githubusercontent.com/742e09545f1085cd47563d47002012e0aad4ed7e671fe95cf25585459cf02088/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69616e772f717569636b63686172742e7376673f7374796c653d666c6174)](https://packagist.org/packages/ianw/quickchart)

A PHP client for the [quickchart.io](https://quickchart.io/) chart image API.

Installation
============

[](#installation)

Use the `QuickChart.php` library in this project, or [install from packagist](https://packagist.org/packages/ianw/quickchart).

```
composer require ianw/quickchart

```

Usage
=====

[](#usage)

This library provides a `QuickChart` class. Import and instantiate it. Then set properties on it and specify a [Chart.js](https://chartjs.org) config:

```
$chart = new QuickChart(array(
  'width' => 500,
  'height' => 300
));

$chart->setConfig('{
  type: "bar",
  data: {
    labels: ["Hello world", "Test"],
    datasets: [{
      label: "Foo",
      data: [1, 2]
    }]
  }
}');
```

Use `getUrl()` on your QuickChart object to get the encoded URL that renders your chart:

```
echo $chart->getUrl();
// 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&w=500&h=300
```

If 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):

```
echo $chart->getShortUrl();
// https://quickchart.io/chart/render/f-a1d3e804-dfea-442c-88b0-9801b9808401
```

The URLs will render an image of a chart:

[![](https://camo.githubusercontent.com/35c5ae135fbd096ba6bb6239184fa71ce660863d5eff75c8c6708352c04ead26/68747470733a2f2f717569636b63686172742e696f2f63686172743f633d253742253232747970652532322533412b2532326261722532322532432b253232646174612532322533412b2537422532326c6162656c732532322533412b25354225323248656c6c6f2b776f726c642532322532432b253232546573742532322535442532432b25323264617461736574732532322533412b2535422537422532326c6162656c2532322533412b253232466f6f2532322532432b253232646174612532322533412b253542312532432b3225354425374425354425374425374426773d36303026683d33303026626b673d25323366666666666626646576696365506978656c526174696f3d322e3026663d706e67)](https://camo.githubusercontent.com/35c5ae135fbd096ba6bb6239184fa71ce660863d5eff75c8c6708352c04ead26/68747470733a2f2f717569636b63686172742e696f2f63686172743f633d253742253232747970652532322533412b2532326261722532322532432b253232646174612532322533412b2537422532326c6162656c732532322533412b25354225323248656c6c6f2b776f726c642532322532432b253232546573742532322535442532432b25323264617461736574732532322533412b2535422537422532326c6162656c2532322533412b253232466f6f2532322532432b253232646174612532322533412b253542312532432b3225354425374425354425374425374426773d36303026683d33303026626b673d25323366666666666626646576696365506978656c526174696f3d322e3026663d706e67)

Creating the chart object
-------------------------

[](#creating-the-chart-object)

The `QuickChart` class constructor accepts an array containing the following keys. All are optional and can be set after object creation:

### config: array or string

[](#config-array-or-string)

The actual Chart.js chart configuration.

### width: int

[](#width-int)

Width of the chart image in pixels. Defaults to 500

### height: int

[](#height-int)

Height of the chart image in pixels. Defaults to 300

### format: string

[](#format-string)

Format of the chart. Defaults to png.

### backgroundColor: string

[](#backgroundcolor-string)

The background color of the chart. Any valid HTML color works. Defaults to #ffffff (white). Also takes rgb, rgba, and hsl values.

### devicePixelRatio: float

[](#devicepixelratio-float)

The 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.

### version: string

[](#version-string)

The Chart.js version to use. See [documentation](https://quickchart.io/documentation/#parameters) for supported versions.

### apiKey: string

[](#apikey-string)

Your QuickChart API key, if you have one.

Setting properties
------------------

[](#setting-properties)

Each option above has an associated function call that you can invoke on your `QuickChart` object:

- `setConfig($config)`
- `setWidth($width)`
- `setHeight($height)`
- `setFormat($format)`
- `setBackgroundColor($backgroundColor)`
- `setDevicePixelRatio($devicePixelRatio)`
- `setVersion($version)`
- `setApiKey($apiKey)`

Getting URLs
------------

[](#getting-urls)

There are two ways to get a URL for your chart object.

### getUrl: string

[](#geturl-string)

Returns a URL that will display the chart image when loaded.

### getShortUrl: string

[](#getshorturl-string)

Uses 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`.

Note 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.

Other outputs
-------------

[](#other-outputs)

### toBinary: binary string

[](#tobinary-binary-string)

Returns a binary string representing the chart image

### toFile($path: string)

[](#tofilepath-string)

Write the image to a file

For example:

```
$chart->toFile('/tmp/myfile.png')
```

More examples
-------------

[](#more-examples)

Checkout the `examples` directory to see other usage.

Troubleshooting
---------------

[](#troubleshooting)

**PHP5 users**: This package requires curl and json modules.

**sslv3 handshake alert failure**: You are using an outdated version of `curl`. Please upgrade curl on your machine.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 74.1% 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 ~0 days

Total

2

Last Release

91d ago

Major Versions

v1.0.0 → v2.0.02026-03-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/3eb6cb36cb128b6bcd97e40cd881784a2cad0b1cd8f363f98edf5ffdf416c57a?d=identicon)[vinayshah5](/maintainers/vinayshah5)

---

Top Contributors

[![typpo](https://avatars.githubusercontent.com/u/310310?v=4)](https://github.com/typpo "typpo (20 commits)")[![arnaudgoulpeau](https://avatars.githubusercontent.com/u/14837692?v=4)](https://github.com/arnaudgoulpeau "arnaudgoulpeau (1 commits)")[![kyletaylored](https://avatars.githubusercontent.com/u/1759794?v=4)](https://github.com/kyletaylored "kyletaylored (1 commits)")[![MarcosBL](https://avatars.githubusercontent.com/u/389801?v=4)](https://github.com/MarcosBL "MarcosBL (1 commits)")[![MrGabriCavi](https://avatars.githubusercontent.com/u/1543667?v=4)](https://github.com/MrGabriCavi "MrGabriCavi (1 commits)")[![vdumontier](https://avatars.githubusercontent.com/u/325251?v=4)](https://github.com/vdumontier "vdumontier (1 commits)")[![ammiranda](https://avatars.githubusercontent.com/u/4405732?v=4)](https://github.com/ammiranda "ammiranda (1 commits)")[![vinayshah](https://avatars.githubusercontent.com/u/4420182?v=4)](https://github.com/vinayshah "vinayshah (1 commits)")

---

Tags

imagechartchartsbar-chartline-chartchart-api

### Embed Badge

![Health badge](/badges/rapiddive-quickchart/health.svg)

```
[![Health](https://phpackages.com/badges/rapiddive-quickchart/health.svg)](https://phpackages.com/packages/rapiddive-quickchart)
```

###  Alternatives

[ianw/quickchart

QuickChart chart API

46699.0k](/packages/ianw-quickchart)[intervention/image

PHP Image Processing

14.3k203.8M2.5k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k52.6M137](/packages/league-glide)[liip/imagine-bundle

This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.

1.7k39.4M238](/packages/liip-imagine-bundle)[spatie/image

Manipulate images with an expressive API

1.4k58.5M175](/packages/spatie-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1558.1M159](/packages/intervention-image-laravel)

PHPackages © 2026

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