New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

gfazioli/laravel-morris-php

Laravel Service Provider for morris.js
2,451 5
Install
composer require gfazioli/laravel-morris-php
Latest Version:1.0.4
PHP:>=5.4.0
Laravel:5
License:MIT
Last Updated:Oct 15, 2026
Links: GitHub  ·  Packagist
Maintainer: gfazioli

Laravel Morris PHP

Latest Stable Version Total Downloads Latest Unstable Version License

Laravel-Morris-PHP at a glance, refreshed daily: commits, releases, stars, issues and pull requests, a year of commit activity, the weekly rhythm, languages, latest commits and releases, contributors
Made with glancecard · refreshed daily

Laravel Morris PHP is the version for Laravel of MorrisPHP With this Service Provider, you can draw amazing char by usign Morris.js.

Requirements

  • PHP 5.5.9 or greater
  • Laravel 5.4 or greater

Installation

composer require gfazioli/laravel-morris-php

Laravel

We include service providers and a facade for easy integration and a nice syntax for Laravel.

Firstly, add the gfazioli\Morris\MorrisServiceProvider provider to the providers array in config/app.php

'providers' => [
  ...
  gfazioli\Morris\MorrisServiceProvider::class,
],

and then add the facade to your aliases array

'aliases' => [
  ...
  'Morris' => gfazioli\Morris\Facades\MorrisFacade::class,
],

HTML

Remember to include the following Javascript and styles before use Morris.

  <!-- Morris -->
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>

Examples

  
<div id="morris-area"></div>

<?php

echo Morris::area( 'morris-area' )
           ->xkey( [ 'y' ] )
           ->ykeys( [ 'a', 'b' ] )
           ->labels( [ 'Series A', 'Series B' ] )
           ->hoverCallback( 'function(index, options, content){var row = options.data[index];return "sin(" + row.x + ") = " + row.y;}' )
           ->data( [
                     [ "y" => '2006', "a" => 100, "b" => 90 ],
                     [ "y" => '2007', "a" => 75, "b" => 65 ],
                     [ "y" => '2008', "a" => 50, "b" => 40 ],
                     [ "y" => '2009', "a" => 75, "b" => 65 ],
                     [ "y" => '2010', "a" => 50, "b" => 40 ],
                     [ "y" => '2011', "a" => 75, "b" => 65 ],
                     [ "y" => '2012', "a" => 100, "b" => 90 ]
                   ] );

  
<div id="morris-bar"></div>
<?php

echo Morris::bar( 'morris-bar' )
           ->xkey( [ 'y' ] )
           ->ykeys( [ 'a', 'b' ] )
           ->labels( [ 'Series A', 'Series B' ] )
           ->data( [
                     [ "y" => '2006', "a" => 100, "b" => 90 ],
                     [ "y" => '2007', "a" => 75, "b" => 65 ],
                     [ "y" => '2008', "a" => 50, "b" => 40 ],
                     [ "y" => '2009', "a" => 75, "b" => 65 ],
                     [ "y" => '2010', "a" => 50, "b" => 40 ],
                     [ "y" => '2011', "a" => 75, "b" => 65 ],
                     [ "y" => '2012', "a" => 100, "b" => 90 ]
                   ] );

  
<div id="morris-donut"></div>
<?php

echo Morris::donut( 'morris-donut' )
           ->data( [
                     [ "label" => "Download Sales", "value" => 12 ],
                     [ "label" => "In-Store Sales", "value" => 30 ],
                     [ "label" => "Mail-Order Sales", "value" => 20 ]
                   ] );

  
<div id="morris-line"></div>
<?php

echo Morris::line( 'morris-line' )
           ->xkey( [ 'date' ] )
           ->ykeys( [ 'value' ] )
           ->labels( [ 'Money' ] )
           ->data( [
                     [ 'date' => '2010', 'value' => 88 ],
                     [ 'date' => '2011', 'value' => 18 ],
                     [ 'date' => '2012', 'value' => 28 ],
                     [ 'date' => '2013', 'value' => 48 ],
                   ] );

Related Packages

kim/javascript

Laravel package to pass PHP variables to your JavaScript files.

23 2
valorin/random

Random is a simple helper package designed to make it easy to generate a range o...

436,338 234
php
cline/variable-keys

Laravel Blueprint macros for variable primary key and morph types

23,466 0
php
cline/struct

Lean, attribute-driven Laravel data objects with explicit validation and Eloquen...

18,346 0
php

Version History

Version Released PHP Laravel License
1.0.4 >=5.4.0 ~5.2 MIT
1.0.3 >=5.4.0 ~5.2 MIT
1.0.2 >=5.4.0 ~5.2 MIT
1.0.1 >=5.4.0 ~5.2 MIT
1.0.0 >=5.4.0 ~5.2 MIT