escolalms / reports
Escola Headless LMS Reports
Installs: 10 410
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
pkg:composer/escolalms/reports
Requires
- php: >=7.4
- escolalms/core: ^1.2
- laravel/framework: >=8.0
- maatwebsite/excel: ^3.1
Requires (Dev)
- escolalms/auth: ^0
- escolalms/cart: ^0.4
- escolalms/courses: ^0.4.13
- escolalms/notifications: ^0
- escolalms/questionnaire: ^0
- escolalms/topic-type-gift: ^0.0.9
- orchestra/testbench: ^6.0|^7.0
- phpunit/phpunit: ^9.0
Suggests
- escolalms/cart: Required for reports about Cart/Payments/etc
- escolalms/courses: Required for reports about Courses
- escolalms/topic-type-gift: Required for reports about Gift/Quiz Topic Type
- dev-main
- 0.1.49
- 0.1.48
- 0.1.47
- 0.1.46
- 0.1.45
- 0.1.44
- 0.1.43
- 0.1.42
- 0.1.41
- 0.1.40
- 0.1.39
- 0.1.38
- 0.1.37
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-feature/user-data
- dev-authored-courses-reports
- dev-feature/readme
- dev-feature/94
- dev-bugfix/issue-8
- dev-feature/increase-code-coverage
- dev-feature/swagger-fix
- dev-feature/workflow
This package is auto-updated.
Last update: 2025-10-28 12:56:00 UTC
README
Package for statistics & reports
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
- composer require escolalms/reports
- php artisan migrate
- php artisan db:seed --class="EscolaLms\Reports\Database\Seeders\ReportsPermissionSeeder"
- optional: php artisan vendor:publish --tag=reportsto publish config file
Dependencies
- EscolaLms\Coursesfor all Courses related stats and metrics
- EscolaLms\Cartfor all metrics related to calculating amounts of money spent
Usage
Configuration
By editing published config reports.php you can:
- Change which metrics are available in API (by editing metrics)
- Change settings for each Metric (by editing metric_configuration)- limitdefines how many data points will be calculated by default (if you don't pass limit as query parameter); for example:- TutorsPopularityMetricwith- limitset to 10 will return popularity of 10 most popular Tutors
- historyis a boolean that defines if this metric should be automatically calculated and stored in database
- cronis cron config which determines how often automatic calculation of metrics happens
 
- Change which stats are available in API (by editing stats) and to which Model they are mapped
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
- 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
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 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
- 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
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
All the endpoints are defined in .
Metrics endpoints
- GET /api/admin/reports/metricsreturns list of- metricsconfigured in- reports.phpconfig file
- GET /api/admin/reports/reportcalculates data for chosen metric; you can pass following query parameters to this endpoint:- metric={classname}is required;- classnameis one of the- metricsreturned in- /api/admin/reports/metricsendpoit
- limit={int}is optional; determines the maximum number of data points that will be returned
- date={date}is optional; will try to load historical report data for given date or return- 404if there is no data available; without this param, endpoint will return today's data
 
Stats endpoints
- GET /api/admin/stats/availablereturns list of- statsconfigured in- reports.phpconfig file
- `GET /api/admin/stats/
Tests
Run ./vendor/bin/phpunit --filter='EscolaLms\\Reports\\Tests' to run tests.
Events
No Events are defined in this package.
Listeners
No Listeners are defined in this package.
How to use this package on Frontend
Admin Panel
Reports dashboard
Course Stats
Permissions
Permissions are defined in Enum and seeded in Seeder.
Roadmap. Todo. Troubleshooting
- ???

