clarion-app/download-manager-backend
Composer 安装命令:
composer require clarion-app/download-manager-backend
包简介
Describe your package
README 文档
README
A Laravel-based backend service for managing downloads in Clarion. This package provides comprehensive torrent management capabilities with support for multiple torrent client implementations.
Overview
The Download Manager Backend is a Clarion app component that enables users to:
- Manage torrent downloads across multiple servers
- Track download status and completion
- Support multiple torrent client types (currently Transmission)
Features
- Multi-Server Support: Manage torrents across multiple torrent servers and client types
- Torrent Lifecycle Management: Add, monitor, and remove torrents with automatic status tracking
- RESTful API: Complete CRUD operations for torrents and torrent servers
- Extensible Client Architecture: Plugin-based system for supporting different torrent clients
- User Association: Link torrents to specific users with authentication support
- Automatic Processing: Background commands for checking torrent status
Architecture
Models
Torrent
Represents individual torrent downloads with the following attributes:
local_node: Node identifier for distributed trackingserver_id: Reference to the torrent server handling the downloaduser_id: Associated user (when authenticated)magnetURI: Magnet link for the torrenthash_string: Unique torrent hash identifiername: Display name (auto-extracted from magnet URI)completed_at: Timestamp when download completed
TorrentServer
Represents torrent client servers with:
local_node: Node identifieraddress: Server connection addresstype: Client type (e.g., "Transmission")
Controllers
TorrentController
index(): List all torrentsstore(): Add new torrent from magnet URIshow(): Get specific torrent detailsupdate(): Modify torrent propertiesmarkIncomplete(): Reset completion statusdestroy(): Remove torrent
TorrentServerController
- Standard CRUD operations for torrent servers
getClientTypes(): List supported client types
Torrent Clients
TransmissionClient
Implementation for Transmission torrent client with:
- RPC communication via HTTP
- Session management with X-Transmission-Session-Id headers
- Methods for adding, checking status, and removing torrents
TorrentClientBase
Abstract base class for implementing additional torrent clients
Commands
CheckTorrent (torrent:check)
Background command that:
- Scans for incomplete torrents
- Checks status with respective torrent clients
- Updates completion timestamps
- Processes torrent lifecycle events
API Endpoints
All endpoints require authentication (auth:api middleware) and use the configured route prefix.
Torrent Servers
GET /torrent-servers/client-types- Get supported client typesGET /torrent-servers- List all serversPOST /torrent-servers- Create new serverGET /torrent-servers/{id}- Get server detailsPUT /torrent-servers/{id}- Update serverDELETE /torrent-servers/{id}- Remove server
Torrents
GET /torrents- List all torrentsPOST /torrents- Add new torrentGET /torrents/{id}- Get torrent detailsPUT /torrents/{id}- Update torrentDELETE /torrents/{id}- Remove torrentPATCH /torrents/{id}/mark-incomplete- Mark as incomplete
Database Schema
Torrents Table
- id (UUID, primary key) - local_node (string) - server_id (UUID, foreign key) - user_id (UUID, nullable) - magnetURI (text) - hash_string (string, nullable) - name (string, nullable) - completed_at (timestamp, nullable) - created_at/updated_at (timestamps) - deleted_at (soft deletes)
Torrent Servers Table
- id (UUID, primary key) - local_node (string) - address (string) - type (string) - created_at/updated_at (timestamps) - deleted_at (soft deletes)
Usage Examples
Adding a Torrent
POST /api/torrents { "magnetURI": "magnet:?xt=urn:btih:...", "server_id": "uuid-of-server" // optional, uses default if not specified }
Checking Torrent Status
The system automatically processes torrents via the torrent:check command, which can be run manually or scheduled:
php artisan torrent:check
Adding a New Torrent Server
POST /api/torrent-servers { "address": "192.168.1.100:9091", "type": "Transmission" }
Extending Client Support
To add support for new torrent clients:
- Create a new class extending
TorrentClientBase - Implement required methods:
add(),check(),remove() - Set the static
$typeproperty - Place in
src/TorrentClients/directory
Example:
class QBittorrentClient extends TorrentClientBase { public static $type = "qBittorrent"; public function add($torrent) { /* implementation */ } public function check($hashString) { /* implementation */ } public function remove($hashString) { /* implementation */ } }
clarion-app/download-manager-backend 适用场景与选型建议
clarion-app/download-manager-backend 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 clarion-app/download-manager-backend 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 clarion-app/download-manager-backend 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-20