定制 escolalms/tracker 二次开发

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

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

escolalms/tracker

最新稳定版本:0.1.0

Composer 安装命令:

composer require escolalms/tracker

包简介

Escola Headless LMS Tracker

README 文档

README

swagger codecov phpunit downloads downloads downloads

What does it do

The package is used to track the api route. Tracker is enabled by default and track routes with /api/admin prefix. By default, /api/admin/tracks/routes is ignored.

Installing

  • composer require escolalms/tracker
  • php artisan migrate
  • php artisan db:seed --class="EscolaLms\Tracker\Database\Seeders\TrackerPermissionSeeder"

Configuration

You can configure this package by specifying keys in the .env file.

  • TRACKER_ENABLED - enable or disable route tracking
  • TRACKER_ROUTE_PREFIX - set tracked route prefix
  • TRACKER_CONNECTION - database connection, by default sqlite

You can also use facade to configure tracker.

Tracker::disable();
Http::get('api/admin/example-route')
Tracker::enable();

... 

Tracker::ignoreUris(['api/admin/example-route']);
Http::get('api/admin/example-route')

... 

Tracker::prefix('api');
Http::get('api/example-route')

Database

TrackRoutes - stores tracked routes

Table track_routes sample rows

id user_id path full_path method extra created_at updated_at
1 2 /api/admin/example-1 /api/admin/example-1?key=value GET NULL 2022-04-14 08:49:25 2022-04-14 08:49:25
2 33 /api/admin/example-2 /api/admin/example-2 POST NULL 2022-04-14 08:49:25 2022-04-14 08:49:25

Endpoints

swagger

Tests

Run ./vendor/bin/phpunit to run tests. See tests folder as it's quite good staring point as documentation appendix.

codecov phpunit

Permissions

Permissions are defined in seeder

Problems

  • No permission to write to the database:

    If you encounter such an error you need to check the permissions of the database.sqlite file on the server. If the file is not given write permissions, SQL will throw an error about not being able to write. The file should have at least 0666 permissions.

  • track_routes table not found:

    The error occurs because the migrations that create the tables have not been run. There is only an empty database file. You should run the php artisan oprimize:clear or php artisan cache:clear command. SqliteServiceProvider will check from the values in the cache whether migrations have been run and if the table does not exist it will create it in the database.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-04