marque/trove 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

marque/trove

Composer 安装命令:

composer require marque/trove

包简介

Core models, services, and contracts for Marque tracker platform

README 文档

README

Core models, services, and contracts for the Marque tracker platform.

Installation

composer require marque/trove

Publish the config and run migrations:

php artisan vendor:publish --tag=trove-config
php artisan migrate

What's Included

  • Torrent model - info_hash, metadata, file storage, bencode parsing
  • TorrentService - CRUD, .torrent file upload/parsing, search
  • Role system - User, Uploader, Moderator, Admin hierarchy
  • Tracker stats - Passkey generation, upload/download/seedtime tracking per user
  • Authorization - Policies for create, update, delete operations

User Model Setup

Add the Trove traits and interface to your User model:

use Marque\Trove\Concerns\HasRoles;
use Marque\Trove\Concerns\HasTrackerStats;
use Marque\Trove\Contracts\UserInterface;

class User extends Authenticatable implements UserInterface
{
    use HasRoles, HasTrackerStats;
}

HasRoles gives you role checks:

$user->isAdmin();
$user->isModerator();
$user->isUploader();
$user->hasRoleAtLeast(Role::Moderator);

HasTrackerStats gives you tracker integration:

$user->passkey;                    // Auto-generated 32-char key
$user->getRatio();                 // Upload/download ratio
$user->getRatioForHumans();        // "1.25" or "Inf"
$user->getUploadedForHumans();     // "4.2 GB"
$user->meetsRatioRequirement(0.5); // Boolean

Working with Torrents

use Marque\Trove\Contracts\TorrentServiceInterface;

$service = app(TorrentServiceInterface::class);

// List with pagination and search
$torrents = $service->list(perPage: 25, search: 'ubuntu');

// Upload a .torrent file (extracts info_hash, size, file count automatically)
$torrent = $service->createFromUpload($file, $user, 'Ubuntu 24.04', 'Official ISO');

// Find by info hash
$torrent = $service->findByInfoHash('a1b2c3d4...');

// Update
$service->update($torrent, ['name' => 'New Name']);

// Delete (removes stored file too)
$service->delete($torrent);

Configuration

Published to config/trove.php:

Key Default Description
user_model App\Models\User Your User model class
storage_disk local Filesystem disk for .torrent files
ratio_mode full Ratio enforcement: full, off, or seedtime
min_ratio 0.5 Minimum required ratio (when mode is full)
min_seedtime 86400 Minimum seedtime in seconds (when mode is seedtime)

Migrations

Trove creates:

  • torrents table (info_hash, name, description, size, file_count, torrent_file, user_id)
  • Adds role column to users table
  • Adds passkey, uploaded, downloaded, seedtime columns to users table

Publish migrations to customise them:

php artisan vendor:publish --tag=trove-migrations

Roles

Four roles with a strict hierarchy:

Role Rank Can Upload Can Moderate
User 0 No No
Uploader 1 Yes No
Moderator 2 Yes Yes
Admin 3 Yes Yes

Authorization

Trove registers a TorrentPolicy:

  • Create - Uploader role or above
  • Update - Torrent owner, or Moderator+
  • Delete - Moderator or above

Requirements

  • PHP 8.2+
  • Laravel 12+

License

MIT

marque/trove 适用场景与选型建议

marque/trove 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-28