Download the PHP package icehouse-ventures/laravel-chartjs without Composer

On this page you can find all versions of the php package icehouse-ventures/laravel-chartjs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-chartjs

laravel-chartjs - A Chart.js wrapper for Laravel

Simple package to facilitate and automate the use of charts and graphs in Laravel using the Chart.js library. The current release supports PHP 8.2+ and Laravel 12 or 13.

Setup

This package provides a wrapper for Chartjs that allows it to be used simply and easily inside a Laravel application. The package supports a number of installation methods depending on your needs and familiarity with JavaScript.

1. Installing this package

Laravel package discovery registers the service provider automatically.

Publishing the config file to your own application will allow you to customise the package with several settings such as the Chartjs version to be used and the delivery method for the Chartjs files.

2. Installing Chart.js

Next, choose how Chart.js will be delivered to your application.

There are several installation options for Chartjs. By default, this package comes set to use the 'custom' self-managed delivery method (to avoid conflict with existing installations). You can also select from several other delivery methods:

CDN

For rapid development and testing between versions, set the delivery method to cdn in config/chartjs.php. Chart.js versions 2, 3 and 4 are available by CDN. The package loads the selected date adapter, plus Numeral.js for backwards compatibility. CDN URLs are pinned to the selected major so a future Chart.js major cannot be pulled into an existing application unexpectedly.

Publish

If you do not use JavaScript packages anywhere else in your application or are new to JavaScript development, then you may not already have the Node Package Manager, Laravel Mix or Vite set up. In that case, this package includes pre-compiled versions of Chartjs that you can use in your application. To publish the chart.js binary to your application's public folder (where JavaScript bundles are stored) you can publish the package's pre-built distribution assets.

By default, the publish method will install Chartjs version 4 using the latest version in the package. If you want to publish an older version, we have also included the latest stable Chartjs releases for version 3 and version 2. You can publish these to your public assets folder using the following commands:

Binary

In some rare circumstances, such as local development without an internet connection, private applications, shared servers or where you cannot access the public folder on your server, then you may wish to have end-users directly load the binary files. This method is not recommended because it streams the contents of the files from inside your application. This delivery method will load the Chartjs files normally published to your assets folder, directly from inside your vendor folder. To use this method, set the delivery config variable to 'binary' and choose the Chartjs version you wish to use in the config file.

NPM (Best Practice)

The recommended method is to include Chart.js in your application's normal JavaScript bundle using npm and Vite. See the official Chart.js installation guide. The other delivery methods are useful when a JavaScript build pipeline is not available.

Custom

If you leave the config as blank or 'custom', then the package will assume that the Chart JS JavaScript has been loaded manually. You can do this by adding a CDN to the header of your page such as:

Usage:

You can call the package Facade to easily load the service responsible for building the charts and then pass through a fluent Laravel-style interface to set your various chart settings.

The builder needs the name of the chart, the type of chart (that can be anything that is supported by Chartjs) and the other custom configurations like labels, datasets and options.

Responsive sizing

The canvas width and height attributes are initial drawing-buffer sizes in pixels, not CSS percentages. For a chart that follows its container, size the wrapper with CSS and let Chart.js handle the canvas:

In the dataset interface you can pass any configuration and options to your chart. All options available in Chartjs documentation are supported. Just write the configuration with php array notations and it works!

Advanced Chartjs options

The basic options() method allows you to add simple key-value pair based options. Using the optionsRaw() method it's possible to add more complex nested Chartjs options in raw json format and to used nested calls to the options for plugins:

Passing raw JavaScript options to the chart:

The string form of optionsRaw() is inserted as executable JavaScript. Only use it with application-authored values; never interpolate user input. Prefer passing an array when callbacks or other JavaScript expressions are not required.

Examples

1 - Line Chart:

2 - Bar Chart:

3 - Pie Chart / Doughnut Chart:

Advanced Custom Views

If you need to edit the underlying Blade component (to adjust CDN logic or deeper CSS changes to the <canvas> element used to render the charts), you can publish the views:

You can then customise the published Blade file at ./views/vendor/laravelchartjs/chart-template.blade.php in your application.

To revert any customisation, simply delete or rename this file from your application.

Livewire Interactive Charts

This package supports dynamically updated charts in Livewire. The current release and demo repository are tested with Livewire 4. Conventions for computed properties and public state may differ on earlier Livewire versions.

Legacy API

The previous builder API is retained for applications upgrading to this major. It can be accessed through app()->chartjs, and the chart can be rendered directly with {!! $chart->render() !!}.

Contributing

Laravel Chart.js is community-maintained. Contributions from first-time and returning contributors are welcome: bug reproductions, documentation fixes, tests, accessibility improvements, and compatibility updates all help. Open an issue or discussion for design questions, or send a focused pull request for a well-understood change.

Development

composer check runs Pint, PHPStan and the Pest test suite. The committed dist/chart.js bundle is built from the versions locked in package-lock.json.

License

LaravelChartjs is open-sourced software licensed under the MIT license.

Provenance

Some of the original logic was developed by Brian Faust. The package from which this version was forked was primarily developed and maintained by Felix Costa. Icehouse Ventures adopted stewardship in 2024 and maintains the project with its community of contributors.


All versions of laravel-chartjs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package icehouse-ventures/laravel-chartjs contains the following files

Loading the files please wait ...