Laravel Charts Package

⚡ Charts - The missing laravel charting library written with PHP 7 with lots of front-ends available.

What is charts?

Charts is a PHP (Laravel) library to handle all the charts in your application. It supports multiple charting libraries and they allow to be loaded over AJAX with a nice loading animation.

It uses a simple API to create all the JS logic for you. You just need to write a few PHP lines :)

 

Supported libraries

 

Chartjs

Highcharts

Fusioncharts

Echarts

Frappe

C3

 

Getting started

 

Laravel Charts is a charting library for laravel, and it's the only PHP package that's able to generate unlimited combinations of charts out of the box.

This is because Chart's API is designed to be extensible and customizable, allowing any option in the JavaScript library to be quickly used without effort.

Before we go any deep, let me show you how does an example chart look like.

Why a Laravel library?

Turns out that the charts are mostly done in JavaScript nowadays, but the data they contain most likely comes from a database, and Laravel is the one handling it. So the question is, should you use this library or go straight to a JavaScript one?

It depends... Using this library will still give you all the freedom you have to expect from a native JS library. This is due the fact that you can interact with natively with the chart in diferent ways. First of all, it allows for customization with the same API that the native one, and second, it stores the chart into a variable that you can still read and use in JavaScript.

If you still want to continue, head over the installation.

Installation

 

To install Laravel Charts you'll need composer. Laravel charts require no other dependency so it's really lightweight.

Composer

To install it using composer type the following command in your laravel's root folder.

composer require consoletvs/charts:6.*

This will install laravel charts into your existing project.

Service provider

TIP

If you're using Laravel 5.5 or higher you can skip this step

Register the service provider in thefile located at: config/app.php in the providers key.

ConsoleTVs\Charts\ChartsServiceProvider::class,

Default Configuration

To publish the default configuration for the library, you'll need to run the following command in the project folder.

php artisan vendor:publish --tag=charts_config

Tags :