PHPackages                             moffhub/mps-spec - 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. [Payment Processing](/categories/payments)
4. /
5. moffhub/mps-spec

ActiveLibrary[Payment Processing](/categories/payments)

moffhub/mps-spec
================

Moffhub Payment Standard - Interfaces, DTOs, Enums, and Event Schemas for building payment connectors.

v0.1.0(3mo ago)0342MITPHPPHP ^8.4|^8.5CI passing

Since Apr 25Pushed 3mo agoCompare

[ Source](https://github.com/Moffhub-Solutions/mps-spec)[ Packagist](https://packagist.org/packages/moffhub/mps-spec)[ Docs](https://github.com/Moffhub-Solutions/mps-spec)[ RSS](/packages/moffhub-mps-spec/feed)WikiDiscussions develop Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (2)

Moffhub Payment Standard (MPS)
==============================

[](#moffhub-payment-standard-mps)

The contract layer for building payment and service connectors against the **Moffhub Payment Standard**. This package contains only interfaces, DTOs, enums, and exceptions — no runtime logic, no framework dependencies. Implement against this and you are MPS-compliant.

If you only want to **use** a connector, you don't need this package directly. If you are **building** a connector, start with [`moffhub/connector-sdk`](https://packagist.org/packages/moffhub/connector-sdk), which provides a base class you can extend.

Installation
------------

[](#installation)

```
composer require moffhub/mps-spec
```

Requires PHP 8.3+.

What's in the box
-----------------

[](#whats-in-the-box)

- **Contracts** (`Moffhub\MpsSpec\Contracts\`) — `ConnectorInterface`, `ServiceConnectorInterface`, plus capability mixins (`HasChargeCapability`, `HasRefundCapability`, `HasSettlementCapability`, `HasDisbursementCapability`, `HasWebhookCapability`, `HasProvisioningCapability`).
- **Data** (`Moffhub\MpsSpec\Data\`) — Immutable `final readonly` DTOs: `ChargeRequest`, `ChargeResponse`, `ConnectorManifest`, `MoneyAmount`, `SettlementReport`, etc.
- **Enums** (`Moffhub\MpsSpec\Enums\`) — Backed string enums: `Capability`, `Channel`, `ChargeStatus`, `Currency`, `ConnectorType`, `SettlementModel`, etc.
- **Exceptions** (`Moffhub\MpsSpec\Exceptions\`) — Domain exceptions like `ChargeFailedException`, `WebhookVerificationFailedException`.

The two connector shapes
------------------------

[](#the-two-connector-shapes)

A connector is one of two things:

TypePurposeImplements**Payment Connector**Moves money (charges, refunds, settlements, disbursements)`ConnectorInterface` + capability mixins**Service Connector**Domain validation and lifecycle (e.g. utility bill lookup, ticketing)`ServiceConnectorInterface`Every connector declares its capabilities, channels, currencies, and required config in a `ConnectorManifest` returned from `manifest()`. The platform reads the manifest to wire up the connector.

Minimal example
---------------

[](#minimal-example)

Here's the contract surface for a connector that takes payments and processes refunds:

```
use Moffhub\MpsSpec\Contracts\ConnectorInterface;
use Moffhub\MpsSpec\Contracts\HasChargeCapability;
use Moffhub\MpsSpec\Contracts\HasRefundCapability;
use Moffhub\MpsSpec\Data\ChargeRequest;
use Moffhub\MpsSpec\Data\ChargeResponse;
use Moffhub\MpsSpec\Data\ConnectorManifest;
use Moffhub\MpsSpec\Data\HealthStatus;
use Moffhub\MpsSpec\Data\RefundResponse;
use Moffhub\MpsSpec\Enums\Capability;
use Moffhub\MpsSpec\Enums\Channel;
use Moffhub\MpsSpec\Enums\SettlementModel;

final class AcmeConnector implements ConnectorInterface, HasChargeCapability, HasRefundCapability
{
    public function manifest(): ConnectorManifest
    {
        return new ConnectorManifest(
            connectorId: 'acme',
            displayName: 'Acme Payments',
            version: '1.0.0',
            specVersion: '0.1',
            vendorName: 'Acme Inc.',
            vendorWebsite: 'https://acme.example',
            vendorSupportEmail: 'support@acme.example',
            supportedChannels: [Channel::Card],
            supportedCurrencies: ['USD'],
            capabilities: [Capability::Payment, Capability::Refund],
            settlementModel: SettlementModel::T1,
            requiredConfig: [/* ConfigField entries */],
        );
    }

    public function initialize(array $config): void { /* ... */ }
    public function healthCheck(): HealthStatus { /* ... */ }
    public function destroy(): void { /* ... */ }

    public function createCharge(ChargeRequest $request): ChargeResponse { /* ... */ }
    public function queryCharge(string $chargeId): ChargeResponse { /* ... */ }
    public function refund(string $chargeId, ?int $amountMinor = null): RefundResponse { /* ... */ }
}
```

In practice, you should extend `Moffhub\ConnectorSdk\BaseConnector` instead of implementing `ConnectorInterface` directly — it handles config validation and lifecycle for you.

Capabilities
------------

[](#capabilities)

A connector advertises capabilities by listing them in the manifest **and** implementing the matching mixin:

CapabilityInterfaceMethods`Payment``HasChargeCapability``createCharge`, `queryCharge``Refund``HasRefundCapability``refund``Settlement``HasSettlementCapability``fetchSettlements``Disbursement``HasDisbursementCapability``disburse``Webhook``HasWebhookCapability``handleWebhook``Provisioning``HasProvisioningCapability``provision`The platform discovers a connector's capabilities by `instanceof` checks against these interfaces, so the manifest and the implementation must agree.

Spec versioning
---------------

[](#spec-versioning)

The `specVersion` field on `ConnectorManifest` declares which version of MPS the connector targets. This package's tagged version *is* the spec version — pin it explicitly:

```
"require": {
    "moffhub/mps-spec": "^0.1"
}
```

Breaking changes to interfaces or DTOs ship in a new major version.

License
-------

[](#license)

MIT. See `LICENSE`.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b5c3549bf8f8bab163b760fe2023fe357a3c85ed366e052a735ff5c50f84518?d=identicon)[Moffrough](/maintainers/Moffrough)

---

Top Contributors

[![MOFFROUGH](https://avatars.githubusercontent.com/u/20206597?v=4)](https://github.com/MOFFROUGH "MOFFROUGH (9 commits)")

---

Tags

specificationpaymentsconnectorkenyaafricamoffhubmpspayment-standard

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/moffhub-mps-spec/health.svg)

```
[![Health](https://phpackages.com/badges/moffhub-mps-spec/health.svg)](https://phpackages.com/packages/moffhub-mps-spec)
```

PHPackages © 2026

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