PHPackages                             mitsuki/mitsuki-orm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mitsuki/mitsuki-orm

ActiveLibrary[Database &amp; ORM](/categories/database)

mitsuki/mitsuki-orm
===================

A lightweight wrapper around Doctrine ORM 3 providing reflection-based repository mapping, advanced query helpers, and metadata caching.

v1.0.0(1mo ago)00MITPHPCI passing

Since Mar 20Pushed 1mo agoCompare

[ Source](https://github.com/zgeniuscoders/mitsuki-orm)[ Packagist](https://packagist.org/packages/mitsuki/mitsuki-orm)[ RSS](/packages/mitsuki-mitsuki-orm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Mitsuki ORM
===========

[](#mitsuki-orm)

 **⚡ A lightweight, high-performance ORM wrapper for Doctrine 3**

 Simplify your repositories. Eliminate boilerplate. Boost performance.

 [![](https://camo.githubusercontent.com/a470606f660d1242d8bca3bfe3300787361bf4666601e58d272d86a73ea00367/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312b2d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/a470606f660d1242d8bca3bfe3300787361bf4666601e58d272d86a73ea00367/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312b2d626c75653f7374796c653d666c61742d737175617265) [![](https://camo.githubusercontent.com/0762f29a239061bc17ae82b55c717b5a54ee708eb5166368c9448a26085f5406/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f637472696e652d4f524d253230332d6f72616e67653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/0762f29a239061bc17ae82b55c717b5a54ee708eb5166368c9448a26085f5406/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f637472696e652d4f524d253230332d6f72616e67653f7374796c653d666c61742d737175617265) [![](https://camo.githubusercontent.com/152aa2a37725b9fd554b28ff24d270f6071c67927a63e6d635a55c8e188e20c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/152aa2a37725b9fd554b28ff24d270f6071c67927a63e6d635a55c8e188e20c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265) [![](https://camo.githubusercontent.com/65d05eecb8ca53a7ca3d929ceca1ccb42b1ac981c50b17e358aafd0dea76eda7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d50617373696e672d627269676874677265656e3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/65d05eecb8ca53a7ca3d929ceca1ccb42b1ac981c50b17e358aafd0dea76eda7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d50617373696e672d627269676874677265656e3f7374796c653d666c61742d737175617265) [![](https://camo.githubusercontent.com/1b5db47e50a67459a81225440a0a7af59b5a9d37c1091e9d6b665e292d691c56/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d486967682d737563636573733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/1b5db47e50a67459a81225440a0a7af59b5a9d37c1091e9d6b665e292d691c56/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d486967682d737563636573733f7374796c653d666c61742d737175617265)

---

📖 Overview
----------

[](#-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
----------

[](#-features)

- 🔍 **Automatic Entity Discovery** (zero config)
- ⚡ **Filesystem Cache for Production**
- 🧠 **Smart Reflection Mapping**
- 🔗 **Relationship Helpers**
- 📄 **Pagination Ready (Doctrine Paginator)**
- 🧪 Fully tested with Pest PHP &amp; Mockery
- 🛠️ CLI integration via `mitsuki/commands`

---

📦 Installation
--------------

[](#-installation)

```
composer require mitsuki/mitsuki-orm
```

---

🚀 Quick Start
-------------

[](#-quick-start)

### 1. Create a Repository

[](#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
-------------

[](#-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
-----------------------

[](#-query-builder-helpers)

### Simple Query

[](#simple-query)

```
$userRepository->where([
    'status' => 'active'
]);
```

### AND Conditions

[](#and-conditions)

```
$qb = $userRepository->whereAnd([
    'status' => 'active',
    'role' => 'admin'
]);

$results = $qb->getQuery()->getResult();
```

### OR Conditions

[](#or-conditions)

```
$qb = $userRepository->whereOr([
    'role' => 'admin',
    'role' => 'editor'
]);
```

---

📄 Pagination
------------

[](#-pagination)

```
$paginator = $userRepository->paginate(page: 1, limit: 10);

foreach ($paginator as $user) {
    // ...
}
```

---

🔗 Relationship Management
-------------------------

[](#-relationship-management)

### Get Collection

[](#get-collection)

```
$posts = $userRepository->getCollection($user, 'posts');
```

### Add Related Entity

[](#add-related-entity)

```
$userRepository->addRelated($user, 'posts', $post);
```

### Get Single Relation

[](#get-single-relation)

```
$profile = $userRepository->getRelated($user, 'profile');
```

---

⚡ Performance Optimization
--------------------------

[](#-performance-optimization)

Enable caching in production:

```
$repo = new UserRepository(
    entityManager: $entityManager,
    cachePath: '/path/to/cache',
    useCache: true
);
```

### Cache Strategy

[](#cache-strategy)

StepDescription1In-memory cache2Filesystem cache3Reflection fallback4Cache warmup---

🧹 CLI Commands
--------------

[](#-cli-commands)

```
php hermite repository:clear
```

### Behavior

[](#behavior)

- ✅ Removes cache file
- ℹ️ Shows info if no cache exists
- ❌ Returns error on failure

---

🧪 Testing
---------

[](#-testing)

```
composer test
```

✔ Covers:

- Cache system
- CLI commands
- Repository logic
- Error scenarios

---

🏗️ Architecture
---------------

[](#️-architecture)

```
Repository Pattern
    ↓
Reflection Mapping
    ↓
Filesystem Cache
    ↓
Doctrine QueryBuilder

```

---

📁 Project Structure
-------------------

[](#-project-structure)

```
src/
 ├── ORM/
 │   ├── Repositories/
 │   │   └── Repository.php
 │   ├── Command/
 │   │   └── RepositoryClearCommand.php
tests/

```

---

⚠️ Requirements
---------------

[](#️-requirements)

- PHP 8.1+
- Doctrine ORM 3+
- Symfony Filesystem

---

📜 License
---------

[](#-license)

MIT License — free for personal and commercial use.

---

👨‍💻 Author
----------

[](#‍-author)

**Zgenius Matondo**📧

---

⭐ Support the Project
---------------------

[](#-support-the-project)

If you like this project:

- ⭐ Star the repository
- 🐛 Report issues
- 🤝 Contribute

---

🔥 Roadmap (Optional but Pro Touch)
----------------------------------

[](#-roadmap-optional-but-pro-touch)

- Soft delete support
- Query caching layer
- Event system (hooks)
- Multi-tenant support
- API Platform integration

---

💡 Final Thought
---------------

[](#-final-thought)

> Mitsuki ORM is built for developers who love Doctrine — but hate boilerplate.

---

![Latest Version](https://camo.githubusercontent.com/aac7a90079e950c5b919db959c7d40996387b182483e34da44a81d50275d29b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d697473756b692f6d697473756b692d6f726d2e737667)![Downloads](https://camo.githubusercontent.com/4a5f456cac802f8519e236675bb99044082b506728e61c982f132f61c175809d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d697473756b692f6d697473756b692d6f726d2e737667)![License](https://camo.githubusercontent.com/1031b7f8eb71448a12712f534db33402b74e861c79142ef305906e0c5ca1ca07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d697473756b692f6d697473756b692d6f726d2e737667)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59ea5d2ce29d5426a3d7feabbcc7b07772b03dd80e4cd13afd6f9ac5e0469998?d=identicon)[zgenius](/maintainers/zgenius)

---

Top Contributors

[![zgeniuscoders](https://avatars.githubusercontent.com/u/101071661?v=4)](https://github.com/zgeniuscoders "zgeniuscoders (21 commits)")

---

Tags

phpdatabaseperformancereflectionormdoctrinepaginationcachequery builderrepositorydoctrine-orm

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/mitsuki-mitsuki-orm/health.svg)

```
[![Health](https://phpackages.com/badges/mitsuki-mitsuki-orm/health.svg)](https://phpackages.com/packages/mitsuki-mitsuki-orm)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M35](/packages/scienta-doctrine-json-functions)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[laravel-doctrine/fluent

A fluent PHP mapping driver for Doctrine2.

43430.3k13](/packages/laravel-doctrine-fluent)[mediagone/doctrine-specifications

Doctrine implementation of repository Specifications pattern

353.8k3](/packages/mediagone-doctrine-specifications)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
