Download the PHP package fr3nch13/cakephp-stats without Composer
On this page you can find all versions of the php package fr3nch13/cakephp-stats. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fr3nch13/cakephp-stats
More information about fr3nch13/cakephp-stats
Files in fr3nch13/cakephp-stats
Package cakephp-stats
Short Description Statistics plugin for CakePHP Projects
License MIT
Homepage https://github.com/fr3nch13/cakephp-stats
Informations about the package cakephp-stats
CakePHP Stats Plugin
Track event-driven statistics and render Chart.js line charts in CakePHP applications.
Installation
Install the plugin with Composer:
Usage
Statistics are recorded through the StatsListener. Create an application listener that extends it and maps your application's events to listener methods.
See CakePHP's event system for more on dispatching and handling events.
Create A Listener
src/Event/ArticleListener.php
recordCount() stores the last registered StatsObject on the event result. It does not return the object directly; use $event->getResult() after dispatching when you need it.
Register The Listener
Register the listener during your application or plugin bootstrap.
src/Application.php
Record A Statistic
Dispatch the application event after the work that can fail or redirect has completed.
src/Controller/ArticlesController.php
Render A Chart
Use ChartJsTrait in a controller action. When $range or $timeperiod is omitted, the trait redirects to a URL with the defaults of seven days.
src/Controller/Admin/ArticlesController.php
Read Statistics
Retrieve aggregate counts directly from the plugin table when building an API response or dashboard.
All versions of cakephp-stats with dependencies
cakephp/cakephp Version ^5.4.1
cakephp/migrations Version ^5.2.6
cakephp/plugin-installer Version ^2.0.2