PHP code example of gfazioli / laravel-morris-php

1. Go to this page and download the library: Download gfazioli/laravel-morris-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gfazioli / laravel-morris-php example snippets


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

'aliases' => [
  ...
  'Morris' => gfazioli\Morris\Facades\MorrisFacade::class,
],
html
  
<div id="morris-donut"></div>


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

html
  
<div id="morris-line"></div>


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 ],
                   ] );