承接 dynamik-dev/modman 相关项目开发

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

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

dynamik-dev/modman

Composer 安装命令:

composer require dynamik-dev/modman

包简介

Headless Laravel content-moderation package with a tiered grader pipeline.

README 文档

README

Headless Laravel content moderation. Users flag content, a tiered grader pipeline (denylist, LLM, optional heuristics and hosted classifiers) evaluates it, and a configurable policy either auto-resolves the report or routes it to a human.

modman ships no UI. It dispatches events and exposes three HTTP endpoints; you wire the rest.

Install

composer require dynamik-dev/modman
php artisan vendor:publish --tag=modman-migrations
php artisan vendor:publish --tag=modman-config
php artisan migrate

Optional: publish the default denylist and LLM prompt resources.

php artisan vendor:publish --tag=modman-resources

Set queue env vars if you do not want the default modman queue:

MODMAN_QUEUE=modman
MODMAN_QUEUE_CONNECTION=redis
MODMAN_LLM_DRIVER=anthropic
MODMAN_LLM_MODEL=claude-haiku-4-5
MODMAN_LLM_API_KEY=sk-ant-...

One-page example

Make a host model reportable:

<?php

namespace App\Models;

use Dynamik\Modman\Concerns\Reportable as ReportableTrait;
use Dynamik\Modman\Contracts\Reportable;
use Dynamik\Modman\Support\ModerationContent;
use Illuminate\Database\Eloquent\Model;

class Post extends Model implements Reportable
{
    use ReportableTrait;

    public function toModerationContent(): ModerationContent
    {
        return ModerationContent::make()->withText($this->body);
    }
}

Let a user flag a post:

$post = Post::find($postId);
$report = $post->report(reporter: auth()->user(), reason: 'Spam');

That creates a Report in the pending state, fires ReportCreated, and queues RunModerationPipeline. The orchestrator walks the configured pipeline (denylist then LLM by default) until the policy either auto-resolves the report or routes it to a human.

React to the outcome:

<?php

namespace App\Listeners;

use Dynamik\Modman\Events\ReportResolved;
use Dynamik\Modman\Support\VerdictKind;

class HideRejectedContent
{
    public function handle(ReportResolved $event): void
    {
        if ($event->outcome === VerdictKind::Reject) {
            $event->report->reportable?->update(['hidden_at' => now()]);
        }
    }
}

Register the listener however you prefer (Laravel event discovery, a provider, etc.).

HTTP endpoints

The package registers three routes under the prefix modman, defaulting to the api and auth middleware. Reports return moderator-only data (free-text reasons, LLM evidence, full decision history), so the routes ship behind authentication and an explicit authorization gate.

Method Path Name
GET /modman/reports/{report} modman.reports.show
POST /modman/reports/{report}/resolve modman.reports.resolve
POST /modman/reports/{report}/reopen modman.reports.reopen

resolve takes { "decision": "approve" | "reject", "reason": "optional string" }. reopen takes an optional reason. Both require $request->user() to be an Eloquent Model and to pass the matching gate.

Disabling or overriding the routes

// config/modman.php
'routes' => [
    'enabled' => true,                    // set false to skip route registration entirely
    'middleware' => ['api', 'auth:sanctum'], // override to match your guard stack
],

When routes.enabled is false, the package registers no HTTP routes — wire your own controllers if you need a different shape.

Authorization gates

modman defines three gates with fail-closed defaults:

  • modman.view — checked before GET /modman/reports/{report}
  • modman.resolve — checked before POST /modman/reports/{report}/resolve
  • modman.reopen — checked before POST /modman/reports/{report}/reopen

All three deny by default (every request returns 403) until the host overrides them. Register replacements in any service provider that boots before ModmanServiceProvider, or simply at runtime — Gate::has() keeps the package from clobbering your definition:

use Dynamik\Modman\Models\Report;
use Illuminate\Support\Facades\Gate;
use App\Models\User;

Gate::define('modman.view', fn (User $user, Report $report) => $user->is_moderator);
Gate::define('modman.resolve', fn (User $user, Report $report) => $user->is_moderator);
Gate::define('modman.reopen', fn (User $user, Report $report) => $user->is_moderator);

The controllers respond with 401 when no user is authenticated, 403 when the authenticated identity is not an Eloquent Model or the gate denies the action.

Where to go next

Requirements

  • PHP 8.4+
  • Laravel 12 or 13
  • spatie/laravel-model-states ^2.7

License

MIT.

dynamik-dev/modman 适用场景与选型建议

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

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

围绕 dynamik-dev/modman 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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