承接 tourze/train-course-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tourze/train-course-bundle

Composer 安装命令:

composer require tourze/train-course-bundle

包简介

培训课程管理系统,提供课程创建、章节管理、学习进度跟踪等功能

README 文档

README

English | 中文

Latest Version PHP Version License Build Status Coverage Quality Score Total Downloads

Training course management bundle for safety production training course lifecycle management.

Table of Contents

Features

  • Course basic information management (title, description, cover, price, etc.)
  • Course category association management
  • Course chapter hierarchical structure management
  • Multimedia content support (mainly videos)
  • Alibaba Cloud VOD video integration and playback
  • Course validity period management
  • Credit hours statistics and management
  • Teacher association management
  • Course audit workflow management
  • Video playback control (anti-fast-forward, speed limitation, watermark)
  • Multi-device playback limitation

Installation

composer require tourze/train-course-bundle

Configuration

Basic Configuration

Configure Alibaba Cloud VOD related environment variables:

JOB_TRAINING_ALIYUN_VOD_ACCESS_KEY_ID=your_access_key_id
JOB_TRAINING_ALIYUN_VOD_ACCESS_KEY_SECRET=your_access_key_secret

Bundle Configuration

Enable the bundle in your Symfony application:

// config/bundles.php
return [
    // ...
    Tourze\TrainCourseBundle\TrainCourseBundle::class => ['all' => true],
];

Quick Start

Creating a Course

<?php

use Tourze\TrainCourseBundle\Entity\Course;
use Tourze\TrainCourseBundle\Entity\Chapter;
use Tourze\TrainCourseBundle\Entity\Video;

// Create course
$course = new Course();
$course->setTitle('Basic Knowledge of Safety Production');
$course->setDescription('This course introduces basic concepts and regulations of safety production');
$course->setPrice(99.00);
$course->setValidDays(365);
$course->setLearnHours(8);

// Create chapter
$chapter = new Chapter();
$chapter->setCourse($course);
$chapter->setTitle('Chapter 1: Overview of Safety Production');
$chapter->setSort(1);

// Create video
$video = new Video();
$video->setChapter($chapter);
$video->setTitle('1.1 Importance of Safety Production');
$video->setUrl('ali://xxxxx'); // Alibaba Cloud VOD video ID
$video->setDuration(600); // 10 minutes

Getting Video Play URL

<?php

use Tourze\TrainCourseBundle\Service\CourseService;

// Inject service
public function __construct(private CourseService $courseService) {}

// Get video play URL from lesson
$playUrl = $this->courseService->getLessonPlayUrl($lesson);

Available Commands

train-course:audit

Process course audit tasks with support for automatic approval and timeout detection.

php bin/console train-course:audit [options]

Options:

  • --dry-run - Dry run mode, only shows what would be processed without execution
  • --auto-approve - Automatically approve qualified courses (requires configuration)

course:backup

Backup course data with support for full and incremental backups.

php bin/console course:backup [options]

Options:

  • --output - Backup file output path (default: var/backup/)
  • --format - Backup format (json|sql, default: json)
  • --incremental - Incremental backup mode

train-course:cleanup

Clean up expired course-related data and cache to maintain system performance.

php bin/console train-course:cleanup [options]

Options:

  • --dry-run - Dry run mode, only shows what would be cleaned
  • --force - Force cleanup, skip confirmation prompt
  • --days - Clean up data older than specified days (default: 30)

train-course:statistics

Generate course statistics reports including course count, evaluation statistics, and collection statistics.

php bin/console train-course:statistics [options]

Options:

  • --format - Output format (table|json|csv, default: table)
  • --output - Output file path (optional)
  • --period - Statistics period (day|week|month|year, default: month)

Usage Examples

Course Management

// Get course service
$courseService = $this->get(CourseService::class);

// Find course by ID
$course = $courseService->findById($courseId);

// Check if course is valid
$isValid = $courseService->isCourseValid($course);

// Get course total duration
$totalDuration = $courseService->getCourseTotalDuration($course);

// Get course progress for a user
$progress = $courseService->getCourseProgress($course, $userId);

Video Playback Control

// Set up playback control
$playControl = new CoursePlayControl();
$playControl->setCourse($course);
$playControl->setAllowFastForward(false);
$playControl->setAllowSpeedControl(true);
$playControl->setWatermarkText('Training Course');
$playControl->setMaxDeviceCount(3);

$entityManager->persist($playControl);
$entityManager->flush();

Advanced Usage

Course Analytics Integration

// Get comprehensive course analytics report
$courseAnalytics = $this->get(CourseAnalyticsService::class);

// Get analytics report for a specific course
$analyticsReport = $courseAnalytics->getCourseAnalyticsReport($course);

// Get course rankings with criteria
$rankings = $courseAnalytics->getCourseRankings([
    'category' => $categoryId,
    'limit' => 10
]);

Course Configuration Management

// Get course configuration service
$configService = $this->get(CourseConfigService::class);

// Get video cache time
$cacheTime = $configService->getVideoPlayUrlCacheTime();

// Check if a feature is enabled
$isEnabled = $configService->isFeatureEnabled('video_watermark');

// Get all configuration
$allConfig = $configService->getAllConfig();

Dependencies

This bundle requires the following Symfony components and third-party packages:

Core Dependencies

  • symfony/framework-bundle: ^7.3
  • doctrine/orm: ^3.0
  • doctrine/doctrine-bundle: ^2.13
  • nesbot/carbon: ^2.72 || ^3

Internal Dependencies

  • tourze/aliyun-vod-bundle: For Alibaba Cloud VOD integration
  • tourze/doctrine-snowflake-bundle: For unique ID generation
  • tourze/doctrine-user-bundle: For user management integration
  • tourze/doctrine-track-bundle: For entity tracking
  • tourze/train-category-bundle: For course category management

Additional Dependencies

  • tourze/enum-extra: For enhanced enum functionality
  • tourze/doctrine-helper: For Doctrine utilities

Testing

Run the test suite:

# Run all tests
vendor/bin/phpunit packages/train-course-bundle/tests

# Run specific test
vendor/bin/phpunit packages/train-course-bundle/tests/Entity/CourseTest.php

# Run with coverage
vendor/bin/phpunit packages/train-course-bundle/tests --coverage-html coverage

Security

Security Considerations

  1. Video Access Control: Always verify user permissions before generating video play URLs
  2. Data Validation: All entity properties are protected with validation constraints
  3. Input Sanitization: User input is automatically sanitized through Symfony validation

Reporting Security Issues

If you discover a security vulnerability, please send an email to security@tourze.com. All security vulnerabilities will be promptly addressed.

Access Control

// Example: Check user access to course
if (!$this->courseService->hasAccess($user, $course)) {
    throw new AccessDeniedException('User does not have access to this course');
}

Important Notes

  1. This bundle focuses on course content management and does not include learning management, user management, or evaluation management features
  2. Alibaba Cloud VOD functionality requires proper access key configuration
  3. It's recommended to use STS temporary credentials instead of fixed AccessKey in production environments
  4. For learning management features, please use other dedicated learning management bundles

Contributing

Please see CONTRIBUTING.md for details.

License

The MIT License (MIT). Please see License File for more information.

References

tourze/train-course-bundle 适用场景与选型建议

tourze/train-course-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 141 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 tourze/train-course-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-29