PHPackages                             mitsuki/contracts - 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. [Framework](/categories/framework)
4. /
5. mitsuki/contracts

ActiveLibrary[Framework](/categories/framework)

mitsuki/contracts
=================

Core interfaces and abstractions for the Mitsuki framework.

v1.0.2(2mo ago)1224MITPHP

Since Feb 16Pushed 2mo agoCompare

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

READMEChangelogDependenciesVersions (4)Used By (4)

Mitsuki Contracts
=================

[](#mitsuki-contracts)

**Mitsuki Contracts** is a set of core interfaces and abstractions for the Mitsuki framework. By using these contracts, you can build decoupled, testable, and interchangeable components.

🚀 Features
----------

[](#-features)

- **Decoupling:** Depend on abstractions, not implementations (Dependency Inversion Principle).
- **Standardization:** Unified error handling and validation flow.
- **Lightweight:** Zero external dependencies (only PHP 8.1+).

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

[](#-installation)

You can install the package via Composer:

```
composer require mitsuki/contracts
```

🛠 Usage
-------

[](#-usage)

### Validation Contract

[](#validation-contract)

To create a request that supports self-validation, implement the `ValidatableRequestInterface`. This ensures your application remains consistent by forcing a `validateOrFail` flow.

```
use Mitsuki\Contracts\Validation\ValidatableRequestInterface;
use Mitsuki\Contracts\Validation\Exceptions\ValidationException;

class RegisterRequest implements ValidatableRequestInterface
{
    public function validateOrFail(): void
    {
        // Your logic: if validation fails...
        // throw new MyValidationException("Invalid data");
    }

    public function getErrors(): array
    {
        return ['email' => ['The email field is required.']];
    }
}
```

### Exception Handling

[](#exception-handling)

All framework-specific exceptions implement the `ExceptionInterface`, allowing for clean global catching:

```
try {
    $request->validateOrFail();
} catch (\Mitsuki\Contracts\Exceptions\ExceptionInterface $e) {
    // Catch any Mitsuki related exception
}
```

👤 Author
--------

[](#-author)

- **Zgenius Matondo** -

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---

### Message de Commit

[](#message-de-commit)

> `docs: create professional README with installation and usage guides`

**Souhaitez-vous que je génère également le fichier `LICENSE` (MIT) avec votre nom pour compléter le dépôt ?**

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance83

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity36

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

Every ~2 days

Total

3

Last Release

87d 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 (1 commits)")

---

Tags

psrframeworkinterfacescontractsmitsuki

### Embed Badge

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

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

PHPackages © 2026

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