mitsuki/mitsuki-orm
Composer 安装命令:
composer require mitsuki/mitsuki-orm
包简介
A lightweight wrapper around Doctrine ORM 3 providing reflection-based repository mapping, advanced query helpers, and metadata caching.
关键字:
README 文档
README
⚡ A lightweight, high-performance ORM wrapper for Doctrine 3
Simplify your repositories. Eliminate boilerplate. Boost performance.
📖 Overview
Mitsuki ORM is a developer-friendly wrapper around Doctrine ORM 3 that removes repetitive repository configuration.
It uses reflection-based entity discovery, filesystem caching, and fluent query helpers to deliver both developer experience and performance.
✨ Features
- 🔍 Automatic Entity Discovery (zero config)
- ⚡ Filesystem Cache for Production
- 🧠 Smart Reflection Mapping
- 🔗 Relationship Helpers
- 📄 Pagination Ready (Doctrine Paginator)
- 🧪 Fully tested with Pest PHP & Mockery
- 🛠️ CLI integration via
mitsuki/commands
📦 Installation
composer require mitsuki/mitsuki-orm
🚀 Quick Start
1. Create a Repository
namespace App\Repository; use Mitsuki\ORM\Repositories\Repository; use App\Entity\User; class UserRepository extends Repository { protected User $userEntity; }
✅ No configuration needed — Mitsuki automatically detects the entity.
🧱 Basic Usage
// Create $userRepository->save($user); // Read $user = $userRepository->find(1); // Update (same as save) $userRepository->save($user); // Delete $userRepository->delete($user); // All $users = $userRepository->findAll();
🔍 Query Builder Helpers
Simple Query
$userRepository->where([ 'status' => 'active' ]);
AND Conditions
$qb = $userRepository->whereAnd([ 'status' => 'active', 'role' => 'admin' ]); $results = $qb->getQuery()->getResult();
OR Conditions
$qb = $userRepository->whereOr([ 'role' => 'admin', 'role' => 'editor' ]);
📄 Pagination
$paginator = $userRepository->paginate(page: 1, limit: 10); foreach ($paginator as $user) { // ... }
🔗 Relationship Management
Get Collection
$posts = $userRepository->getCollection($user, 'posts');
Add Related Entity
$userRepository->addRelated($user, 'posts', $post);
Get Single Relation
$profile = $userRepository->getRelated($user, 'profile');
⚡ Performance Optimization
Enable caching in production:
$repo = new UserRepository( entityManager: $entityManager, cachePath: '/path/to/cache', useCache: true );
Cache Strategy
| Step | Description |
|---|---|
| 1 | In-memory cache |
| 2 | Filesystem cache |
| 3 | Reflection fallback |
| 4 | Cache warmup |
🧹 CLI Commands
php hermite repository:clear
Behavior
- ✅ Removes cache file
- ℹ️ Shows info if no cache exists
- ❌ Returns error on failure
🧪 Testing
composer test
✔ Covers:
- Cache system
- CLI commands
- Repository logic
- Error scenarios
🏗️ Architecture
Repository Pattern
↓
Reflection Mapping
↓
Filesystem Cache
↓
Doctrine QueryBuilder
📁 Project Structure
src/
├── ORM/
│ ├── Repositories/
│ │ └── Repository.php
│ ├── Command/
│ │ └── RepositoryClearCommand.php
tests/
⚠️ Requirements
- PHP 8.1+
- Doctrine ORM 3+
- Symfony Filesystem
📜 License
MIT License — free for personal and commercial use.
👨💻 Author
Zgenius Matondo 📧 zgeniuscoders@gmail.com
⭐ Support the Project
If you like this project:
- ⭐ Star the repository
- 🐛 Report issues
- 🤝 Contribute
🔥 Roadmap (Optional but Pro Touch)
- Soft delete support
- Query caching layer
- Event system (hooks)
- Multi-tenant support
- API Platform integration
💡 Final Thought
Mitsuki ORM is built for developers who love Doctrine — but hate boilerplate.
mitsuki/mitsuki-orm 适用场景与选型建议
mitsuki/mitsuki-orm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「orm」 「performance」 「php」 「cache」 「reflection」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mitsuki/mitsuki-orm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mitsuki/mitsuki-orm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mitsuki/mitsuki-orm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
g4 application profiler package
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
WordPress mu-plugin to remove jQuery Migrate from the list of jQuery dependencies and to allow jQuery to enqueue before </body> instead of in the <head>.
Kinikit - PHP Application development framework MVC component
Store your language lines in the database, yaml or other sources
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-20