PHPackages                             escolalms/reports - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. escolalms/reports

ActivePackage

escolalms/reports
=================

Escola Headless LMS Reports

0.1.49(2y ago)011.0k↓100%11MITPHPPHP &gt;=7.4CI passing

Since Sep 3Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/EscolaLMS/Reports)[ Packagist](https://packagist.org/packages/escolalms/reports)[ RSS](/packages/escolalms-reports/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (66)Used By (1)

EscolaLMS Reports
=================

[](#escolalms-reports)

Package for statistics &amp; reports

[![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/Reports/)[![codecov](https://camo.githubusercontent.com/4590bbb4ca52e062da10a3cdda011456d412652ba24aef6363bc9c4a3ff4ff69/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f5265706f7274732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4f393146484e4b493652)](https://codecov.io/gh/EscolaLMS/Reports)[![phpunit](https://github.com/EscolaLMS/Reports/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/Reports/actions/workflows/test.yml)[![downloads](https://camo.githubusercontent.com/b71f89a1181e588fdc10b3054aa45e3da27f8335e58b1fffed30472dc7fb3264/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6573636f6c616c6d732f7265706f727473)](https://packagist.org/packages/escolalms/reports)[![downloads](https://camo.githubusercontent.com/aa5d302498a94740c5bbc721482f2c4a481d8cf13e621fb650ef40839d3aab0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6573636f6c616c6d732f7265706f727473)](https://packagist.org/packages/escolalms/reports)[![downloads](https://camo.githubusercontent.com/7f914b470e472feb78e673197c4696e942d2178e4b7a8e114edb500d7b2465d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6573636f6c616c6d732f7265706f727473)](https://packagist.org/packages/escolalms/reports)

Purpose
-------

[](#purpose)

This package contains web API for retrieving statistical data about other LMS components (or event any arbitrary non-LMS Models for which Metrics and/or Reports are registered).

Installation
------------

[](#installation)

- `composer require escolalms/reports`
- `php artisan migrate`
- `php artisan db:seed --class="EscolaLms\Reports\Database\Seeders\ReportsPermissionSeeder"`
- optional: `php artisan vendor:publish --tag=reports` to publish config file

Dependencies
------------

[](#dependencies)

- `EscolaLms\Courses` for all Courses related stats and metrics
- `EscolaLms\Cart` for all metrics related to calculating amounts of money spent

Usage
-----

[](#usage)

### Configuration

[](#configuration)

By editing published config `reports.php` you can:

1. Change which metrics are available in API (by editing `metrics`)
2. Change settings for each Metric (by editing `metric_configuration`)
    1. `limit` defines how many data points will be calculated by default (if you don't pass limit as query parameter); for example: `TutorsPopularityMetric` with `limit` set to 10 will return popularity of 10 most popular Tutors
    2. `history` is a boolean that defines if this metric should be automatically calculated and stored in database
    3. `cron` is cron config which determines how often automatic calculation of metrics happens
3. Change which stats are available in API (by editing `stats`) and to which Model they are mapped

### Stats

[](#stats)

Stats are used for calculating some statistical data about given single Model (for example Course or Topic). No historical data is stored, only current data is available.

#### **Available stats**

[](#available-stats)

- `EscolaLms\Reports\Stats\Course\AverageTime` - average time spent on Course by users subscribed to it
- `EscolaLms\Reports\Stats\Course\AverageTimePerTopic` - average time spent on Course by users subscribed to it, grouped by topic
- `EscolaLms\Reports\Stats\Course\MoneyEarned` - sum of money earned by given Course
- `EscolaLms\Reports\Stats\Course\PeopleBought` - count of users that bought given Course
- `EscolaLms\Reports\Stats\Course\PeopleFinished` - count of how many users finished given Course
- `EscolaLms\Reports\Stats\Course\PeopleStarted` - count of how many users started learning given Course
- `EscolaLms\Reports\Stats\Topic\AverageTime` - average time spent on Topic by users subscribed to Course which this topic is part of

#### **Creating your own stat**

[](#creating-your-own-stat)

To create your own Stat, you need to create class implementing `EscolaLms\Reports\Stats\StatContract`. After creating a Stat you need to register it by adding it to `stats` array in config file.

### Metrics

[](#metrics)

Metrics are used for reporting data accumulated over time. Historical data is stored for each day using scheduled job, and requesting a metric returns that historical data (that is, metric values stored at given date).

#### **Available metrics**

[](#available-metrics)

- `EscolaLms\Reports\Metrics\CoursesMoneySpentMetric` - calculates total money spent for every Course (historical data represents total money spent up to given date)
- `EscolaLms\Reports\Metrics\CoursesPopularityMetric` - calculates how many users were subscribed to every Course
- `EscolaLms\Reports\Metrics\CoursesSecondsSpentMetric` - calculates how much times users spent learning every Course
- `EscolaLms\Reports\Metrics\TutorsPopularityMetric` - calculates how many users were subscribed to courses created by given Tutor

#### **Creating your own metric**

[](#creating-your-own-metric)

To create your own Metric, you need to create class implementing `EscolaLms\Reports\Metrics\Contracts\MetricContract`. You can extend `EscolaLms\Reports\Metrics\AbstractMetric` to use default implementations of most of the methods declared in this interface. After creating a Metric you need to register it by adding it to `metrics` array in config file.

Endpoints
---------

[](#endpoints)

All the endpoints are defined in [![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/reports/).

### Metrics endpoints

[](#metrics-endpoints)

1. `GET /api/admin/reports/metrics` returns list of `metrics` configured in `reports.php` config file
2. `GET /api/admin/reports/report` calculates data for chosen metric; you can pass following query parameters to this endpoint:
    1. `metric={classname}` is required; `classname` is one of the `metrics` returned in `/api/admin/reports/metrics` endpoit
    2. `limit={int}` is optional; determines the maximum number of data points that will be returned
    3. `date={date}` is optional; will try to load historical report data for given date or return `404` if there is no data available; without this param, endpoint will return today's data

### Stats endpoints

[](#stats-endpoints)

1. `GET /api/admin/stats/available` returns list of `stats` configured in `reports.php` config file
2. `GET /api/admin/stats/

Tests
-----

[](#tests)

Run `./vendor/bin/phpunit --filter='EscolaLms\\Reports\\Tests'` to run tests.

Test details: [![codecov](https://camo.githubusercontent.com/4590bbb4ca52e062da10a3cdda011456d412652ba24aef6363bc9c4a3ff4ff69/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f5265706f7274732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4f393146484e4b493652)](https://codecov.io/gh/EscolaLMS/Reports)[![phpunit](https://github.com/EscolaLMS/Reports/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/Reports/actions/workflows/test.yml)

Events
------

[](#events)

No Events are defined in this package.

Listeners
---------

[](#listeners)

No Listeners are defined in this package.

How to use this package on Frontend
-----------------------------------

[](#how-to-use-this-package-on-frontend)

### Admin Panel

[](#admin-panel)

#### **Reports dashboard**

[](#reports-dashboard)

[![Reports dashboard](docs/reports.png "Reports dashboard")](docs/reports.png)

#### **Course Stats**

[](#course-stats)

[![Course statistics](docs/course.png "Course statistics")](docs/course.png)

Permissions
-----------

[](#permissions)

Permissions are defined in [Enum](src/Enums/ReportsPermissionsEnum.php) and seeded in [Seeder](database/seeders/ReportsPermissionSeeder.php).

Roadmap. Todo. Troubleshooting
------------------------------

[](#roadmap-todo-troubleshooting)

- ???

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance45

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Recently: every ~35 days

Total

57

Last Release

778d ago

PHP version history (3 changes)0.0.1PHP &gt;=7.4 | &gt;=8.0

0.1.16PHP ^7.4|^8.0

0.1.48PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/c857f3115c790c573d0617d7e9ba4011269ef7b9dfdb003dc4388846a62b14f7?d=identicon)[qunabu](/maintainers/qunabu)

---

Top Contributors

[![pa-cholek](https://avatars.githubusercontent.com/u/5345420?v=4)](https://github.com/pa-cholek "pa-cholek (31 commits)")[![dyfero](https://avatars.githubusercontent.com/u/59400506?v=4)](https://github.com/dyfero "dyfero (16 commits)")[![daVitekPL](https://avatars.githubusercontent.com/u/58150098?v=4)](https://github.com/daVitekPL "daVitekPL (14 commits)")[![mako321](https://avatars.githubusercontent.com/u/59456825?v=4)](https://github.com/mako321 "mako321 (12 commits)")[![qunabu](https://avatars.githubusercontent.com/u/214608?v=4)](https://github.com/qunabu "qunabu (8 commits)")[![HerbertIV](https://avatars.githubusercontent.com/u/62691459?v=4)](https://github.com/HerbertIV "HerbertIV (3 commits)")[![dicani0](https://avatars.githubusercontent.com/u/58490533?v=4)](https://github.com/dicani0 "dicani0 (3 commits)")[![KrzysztofDziedziechEscolasoft](https://avatars.githubusercontent.com/u/96292232?v=4)](https://github.com/KrzysztofDziedziechEscolasoft "KrzysztofDziedziechEscolasoft (2 commits)")[![krzEscola](https://avatars.githubusercontent.com/u/85549830?v=4)](https://github.com/krzEscola "krzEscola (1 commits)")

---

Tags

laravelreporting

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/escolalms-reports/health.svg)

```
[![Health](https://phpackages.com/badges/escolalms-reports/health.svg)](https://phpackages.com/packages/escolalms-reports)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[krayin/laravel-crm

Krayin CRM

22.0k32.8k1](/packages/krayin-laravel-crm)[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[ronasit/laravel-helpers

Provided helpers function and some helper class.

1475.7k13](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

A package to create datatables using alpinejs, tailwind, livewire and laravel

1217.2k1](/packages/team-nifty-gmbh-tall-datatables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
