定制 escolalms/reports 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

escolalms/reports

Composer 安装命令:

composer require escolalms/reports

包简介

Escola Headless LMS Reports

README 文档

README

Package for statistics & reports

swagger codecov phpunit downloads downloads downloads

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=reports to publish config file

Dependencies

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

Usage

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 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 swagger.

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

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

Tests

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

Test details: codecov phpunit

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

Reports dashboard

Course Stats

Course statistics

Permissions

Permissions are defined in Enum and seeded in Seeder.

Roadmap. Todo. Troubleshooting

  • ???

escolalms/reports 适用场景与选型建议

escolalms/reports 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.8k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 escolalms/reports 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 escolalms/reports 我们能提供哪些服务?
定制开发 / 二次开发

基于 escolalms/reports 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11.8k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-03