PHPackages                             koenster/php-graphs - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. koenster/php-graphs

AbandonedArchivedProject[Utility &amp; Helpers](/categories/utility)

koenster/php-graphs
===================

A PHP library for JS charts.

v0.1.2(10y ago)45.1k1MITPHPPHP &gt;=5.5.9

Since Feb 14Pushed 10y ago2 watchersCompare

[ Source](https://github.com/koenster/php-graphs)[ Packagist](https://packagist.org/packages/koenster/php-graphs)[ RSS](/packages/koenster-php-graphs/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

\#PHP graphs

A PHP library to cast a collection of data into a graph object which your favourite js graph library can convert into a beautiful graph for your application.

\##Requirements

- PHP 5.5.9 or greater

\##Supported javascript libraries

Current JS implementations:

- Chart.js ()
- morris.js ()

\##Implementation

\###App

```

use koenster\PHPGraphs\contract\ChartContract;
use koenster\PHPGraphs\PHPChart;

$chart = new PHPChart(PHPChart::IMPLEMENTATION_CHART_JS);

$graph = $chart->add(PHPChart::TYPE_LINE, 'results', ['width' => 400, 'height' => 400]);
$graph->setLine([100,75,50,75,50,75,100], ['label' => 'Costs'])
    ->setLine([90,65,40,65,40,65,150], ['label' => 'Revenue'])
    ->setDimensions(['2006', '2007', '2008', '2009', '2010', '2011', '2012']);

```

\###View

```
