PHPackages                             feijs/morris-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. feijs/morris-graphs

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

feijs/morris-graphs
===================

Generate morris graphs for laravel

3131PHP

Since Sep 19Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Feijs/MorrisGraphs)[ Packagist](https://packagist.org/packages/feijs/morris-graphs)[ RSS](/packages/feijs-morris-graphs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MorrisGraphs
============

[](#morrisgraphs)

[![](https://camo.githubusercontent.com/0145103cf12eb835b2630481d7fa112c1039b88b15d0cd906553d979250a4124/68747470733a2f2f7472617669732d63692e6f72672f4665696a732f4d6f727269734772617068732e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/0145103cf12eb835b2630481d7fa112c1039b88b15d0cd906553d979250a4124/68747470733a2f2f7472617669732d63692e6f72672f4665696a732f4d6f727269734772617068732e7376673f6272616e63683d6d6173746572)

This package provides a class to easily generate dynamic graphs with [Morris.js](http://morrisjs.github.io/morris.js/)

Installation
------------

[](#installation)

Add the package in `composer.json` and run `composer update`

```
"require": {
	"feijs/morris-graphs": "dev-master"
}
```

Add the ServiceProvider to the providers in `config\app.php`

```
'Feijs\MorrisGraphs\MorrisGraphsServiceProvider'
```

And publish the package assets:

```
php artisan asset:publish "feijs/morris-graphs"
```

Usage
-----

[](#usage)

### Creating a graph

[](#creating-a-graph)

Create a Factory object and pass this to a view

```
use Feijs\MorrisGraphs\Factory as Graph;

public function show()
{
	$graph = new Graph();
	return View::make('views.index')->with('graph', $graph)
}
```

Then in your view include the following:

```
{{ $graph->includes() }}	//Preferably once per page

{{ $graph->div() }}			//Where you want to place the graph

{{ $graph->ranges('7', '14', 21) }}		//Add buttons for data ranges

{{ $graph->dynamic($source_url, ['quantity1', 'quantity2']) }}

//Or

{{ $graph->fixed([$source_data], ['quantity1', 'quantity2']) }}
```

For Donut graphs the second parameter may be ommitted

### Data

[](#data)

Source data should be organised as follows:

```
[
	['x-key' => 'x-value', 'y1' => 'y1-value', 'y2' => `y2-value`, ...],
	['x-key' => 'x-value', 'y1' => 'y1-value', 'y2' => `y2-value`, ...],
	...
]
```

Except for donuts graphs, where it should be:

```
[
	['label' => 'Label1', 'value' => 'Value1'],
	['label' => 'Label2', 'value' => 'Value2'],
	...
]
```

### Settings

[](#settings)

To customize graph settings you can call the following setters

#### Horizontal key

[](#horizontal-key)

Must match the horizontal key in the dataset, defaults to `x`

```
$graph->setXKey('segment');
```

#### Graph type

[](#graph-type)

Choose from `Bar`, `Line`, `Area`, `Donut`, defaults to `Bar`

```
$graph->setGraphType('Donut');
```

#### Id

[](#id)

This id will match the script with the the div

```
$graph->setGraphId('1234');
```

#### Height

[](#height)

The height of the graph, defaults to 250px

```
$graph->setHeight('300px');
```

### Label translations

[](#label-translations)

You can specify a file with translations for the graph labels and error message(s) in the config

- Publish the package config files

```
php artisan config:publish "feijs/morris-graphs"
```

- Set the translation file in `translations.labels` or `translation.messages`

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/aaa638a5fb8ae2b9a9e9d66867bb4beeb81222f4a2df005412cd3baf347beb69?d=identicon)[Feijs](/maintainers/Feijs)

---

Top Contributors

[![Feijs](https://avatars.githubusercontent.com/u/12059414?v=4)](https://github.com/Feijs "Feijs (4 commits)")

### Embed Badge

![Health badge](/badges/feijs-morris-graphs/health.svg)

```
[![Health](https://phpackages.com/badges/feijs-morris-graphs/health.svg)](https://phpackages.com/packages/feijs-morris-graphs)
```

PHPackages © 2026

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