kwidoo/mere 问题修复 & 功能扩展

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

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

kwidoo/mere

Composer 安装命令:

composer require kwidoo/mere

包简介

Core menu and resource functionality

关键字:

README 文档

README

`

Kwidoo Mere

Latest Version on Packagist Total Downloads GitHub Actions

Mere = Menu + Resource Reusable backend core for Laravel apps with Vue frontends, providing dynamic menu definitions, resource scaffolding, and centralized configuration for forms, validation, and permissions.

✨ Features

  • 🌲 Menu definitions stored in DB (MenuItem)
  • 🧩 Automatic props generation from model structure
  • 🧪 Reusable validation rules across Laravel + Vue
  • 🔐 Action-level permissions (create/edit/delete)
  • 🧠 Shared base service for clean CRUD logic
  • 📦 Uses Prettus Repository, Fractal, NestedSet
  • 🧰 Includes Artisan command for syncing menu structure

⚙️ Installation

composer require kwidoo/mere

Optional config publish:

php artisan vendor:publish --provider="Kwidoo\Mere\MereServiceProvider"

📁 MenuItem Structure

The MenuItem model defines Vue frontend routes:

Field Description
name Format: ResourceAction (e.g. PropertyList)
path Vue route path (e.g. /properties)
component Vue component name (GenericResource, GenericCreate, etc.)
props Configuration for fields, rules, actions, and label

Example:

{
  "label": "properties",
  "fields": [
    { "key": "name", "label": "Name", "sortable": true, "visible": true }
  ],
  "rules": {
    "name": "required|string|max:255"
  },
  "actions": {
    "create": true,
    "edit": true,
    "delete": false
  }
}

🧪 Syncing Menus via Artisan

You can auto-generate menu definitions using your model and form requests:

php artisan mere:sync-menu --resource=Property

This will:

  • Use App\Models\Property's $fillable and $appends for fields
  • Extract rules from PropertyCreate and PropertyUpdate FormRequests
  • Generate or update the following MenuItems:
    • PropertyList
    • PropertyCreate
    • PropertyUpdate

You can override the default Vue component:

php artisan mere:sync-menu --resource=Property --component=MyCustomPage

🧰 BaseService

Extendable abstract service with automatic:

  • Repository injection
  • Validation
  • CRUD event dispatching
class PropertyService extends BaseService {
    protected function eventKey(): string {
        return 'property';
    }
}

📦 ResourceController

Generic controller for all resource endpoints. Works with:

GET    /api/{resource}
GET    /api/{resource}/{id}
POST   /api/{resource}
PUT    /api/{resource}/{id}
DELETE /api/{resource}/{id}

Bind the service using a middleware or config map:

// config/mere.php
'resources' => [
    'property' => \App\Services\PropertyService::class,
]

🧱 BaseRequest

Dynamic rules resolver:

// POST /api/property => PropertyCreate
// PUT /api/property/{id} => PropertyUpdate

It pulls rules from MenuService::getRules() using route segments.

🧠 Component Detection

Each MenuItem can specify a component such as:

  • GenericResource (list page)
  • GenericCreate (create form)
  • GenericUpdate (edit form)

This is saved as a top-level DB column and not inside props.

📚 API Overview

MenuService

getMenus(): Collection
getFields(string $name): array
getRules(string $name): array

ResourceCollection

(new ResourceCollection(...))
    ->fields([...])
    ->label('properties')
    ->canCreate(true)

🧪 Testing & Extensibility

  • All services can be tested via Laravel’s container
  • You can register custom presenters, validators, or transformers
  • Easy to extend with custom menu fields, UI configs, or ACL logic

🚧 TODO

  • Add granular permission checks
  • Add support for redirect, children in MenuItem tree
  • Sync command enhancements: guessing types, dry-run mode
  • Optional: type-based component mapping

📃 License

MIT

kwidoo/mere 适用场景与选型建议

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

它主要适用于以下技术方向: 「mere」 「kwidoo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-21