escolalms/courses
Composer 安装命令:
composer require escolalms/courses
包简介
Escola Headless LMS Courses
README 文档
README
Courses and content package
What does it do
This package is used for creating Course for EscolaLms.
Installing
composer require escolalms/coursesphp artisan migratephp artisan db:seed --class="EscolaLms\Courses\Database\Seeders\CoursesPermissionSeeder"
Schedule
- Schedules are available in ScheduleServiceProvider
$schedule->job(CheckForDeadlines::class)->hourly()- executed every hours$schedule->job(ActivateCourseJob::class)->daily()- executed every days
Endpoints
All the endpoints are defined in
Tests
Run ./vendor/bin/phpunit --filter 'EscolaLms\\Courses\\Tests' to run tests. See tests folder as it's quite good staring point as documentation appendix.
Events
EscolaLms\Courses\Events\CourseAccessFinished=> Event is dispatched when users lost access to course.EscolaLms\Courses\Events\CourseAccessStarted=> Event is dispatched when users received access to course.EscolaLms\Courses\Events\CourseAssigned=> Event is dispatched when admin assigned access user.EscolaLms\Courses\Events\CourseDeadlineSoon=> Event is dispatched when course deadline is coming out.EscolaLms\Courses\Events\CoursedPublished=> Event is dispatched when course is published.EscolaLms\Courses\Events\CourseFinished=> Event is dispatched when course is ended.EscolaLms\Courses\Events\CourseStarted=> Event is dispatched when course is started.EscolaLms\Courses\Events\CourseStatusChanged=> Event is dispatched when course has a status change.EscolaLms\Courses\Events\CourseTutorAssigned=> Event is dispatched when tutor is assigned to course.EscolaLms\Courses\Events\CourseTutorUnassigned=> Event is dispatched when tutor is unassigned to course.EscolaLms\Courses\Events\CourseUnassigned=> Event is dispatched when user is unassigned to course.EscolaLms\Courses\Events\TopicFinished=> Event is dispatched when course topic is finished.
Permissions
Permissions are defined in seeder
Model relation
The model user must be extended with the class HasCourses :
class User extends EscolaLms\Core\Models\User
{
use HasCourses;
Database relation
There is simple relation. see docs for diagram
Coursegeneral category of the courseLessongrouped by CourseTopicgrouped by Lesson
Course 1 -> n Lesson
Lesson 1 -> n Topic
Topic 1 -> 1 TopicContent
TopicContent is an abstract model, this package contains some sample implementatio eg, RichText, Audio, Video, H5P and Image
You create any of the Content model by post to the same Topic endponit (create and update), see docs examples
Note that /api/topics is using form-data - this is due to PHP nature of posting files
List of possible TopicContents is availabe in the endpoint /api/topics/types
Curriculum/Sylabus/Program
App user access the course by fetching GET /api/courses/{id}/program endpoint. This is after user purchase or has other access to the course. this endpoints renders tree of Course, Lessons, Topic with Contents essential to render whole course.
Adding new TopicContent type
In the ServiceProvider register your class like
use Illuminate\Support\ServiceProvider; use EscolaLms\Courses\Facades\Topic; class CustomServiceProvider extends ServiceProvider { //... public function register() { Topic::registerContentClass(TopicContentCustom::class); // or Topic::registerContentClasses([TopicContentCustom::class, TopicAnotherContentCustom::class]); // also register JSON Resource for a type Topic::registerResourceClasses(Audio::class, [ 'client' => ClientAudioResource::class, 'admin' => AdminAudioResource::class, 'export' => ExportAudioResource::class, ]); } }
see EscolaLmsCourseServiceProvider.php as reference as well as Models/TopicContent
Content
Package comes with seeder that create course with lessons and topics
php artisan db:seed --class="\EscolaLms\Courses\Database\Seeders\CoursesSeeder"
escolalms/courses 适用场景与选型建议
escolalms/courses 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 99.8k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 escolalms/courses 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 escolalms/courses 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 99.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 24
- 推荐数: 5
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-28