PHPackages                             3neti/settlement-envelope - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. 3neti/settlement-envelope

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

3neti/settlement-envelope
=========================

Driver-based evidence envelope system for settlement gating

v1.1.0(2mo ago)063↓76.7%1MITPHPPHP ^8.2

Since Mar 26Pushed 2mo agoCompare

[ Source](https://github.com/3neti/settlement-envelope)[ Packagist](https://packagist.org/packages/3neti/settlement-envelope)[ RSS](/packages/3neti-settlement-envelope/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (15)Versions (7)Used By (1)

Settlement Envelope
===================

[](#settlement-envelope)

A driver-based evidence envelope system for settlement gating. This package provides a structured way to collect and validate evidence before allowing settlement of financial transactions.

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

[](#installation)

```
composer require 3neti/settlement-envelope
```

Core Concepts
-------------

[](#core-concepts)

- **Envelope**: A container bound to a settlement reference (e.g., voucher code, loan ID)
- **Driver**: A YAML configuration that defines the schema, checklist, permissions, and gates
- **Payload**: Versioned JSON metadata attached to the envelope
- **Attachments**: Typed document uploads with review workflow
- **Signals**: External boolean flags (e.g., KYC passed, account created)
- **Gates**: Computed readiness states that determine when settlement is allowed

Usage
-----

[](#usage)

### Creating an Envelope

[](#creating-an-envelope)

```
use LBHurtado\SettlementEnvelope\Services\EnvelopeService;

$service = app(EnvelopeService::class);

$envelope = $service->create(
    referenceCode: 'BST-001',
    driverId: 'bank.home-loan-takeout',
    initialPayload: [
        'borrower' => ['full_name' => 'Juan Dela Cruz'],
        'loan' => ['tcp' => 2000000, 'amount' => 1800000],
    ]
);
```

### Updating Payload

[](#updating-payload)

```
$service->updatePayload($envelope, [
    'loan' => ['ltv' => 0.9]
]);
```

### Uploading Attachments

[](#uploading-attachments)

```
$attachment = $service->uploadAttachment(
    $envelope,
    'BORROWER_ID_FRONT',
    $uploadedFile
);
```

### Setting Signals

[](#setting-signals)

```
$service->setSignal($envelope, 'kyc_passed', true);
$service->setSignal($envelope, 'account_created', true);
```

### Checking Settleable Status

[](#checking-settleable-status)

```
if ($envelope->isSettleable()) {
    $service->lock($envelope);
    $service->settle($envelope);
}
```

Driver Configuration
--------------------

[](#driver-configuration)

Create YAML driver files in `config/envelope-drivers/`:

```
driver:
  id: "my-driver"
  version: "1.0.0"
  title: "My Settlement Driver"

payload:
  schema:
    id: "my-driver.v1"
    format: "json_schema"
    inline:
      type: "object"
      required: ["name"]
      properties:
        name:
          type: "string"

documents:
  registry:
    - type: "ID_DOCUMENT"
      title: "ID Document"
      allowed_mimes: ["application/pdf", "image/jpeg"]
      max_size_mb: 10

checklist:
  template:
    - key: "name_provided"
      kind: "payload_field"
      payload_pointer: "/name"
      required: true
    - key: "id_uploaded"
      kind: "document"
      doc_type: "ID_DOCUMENT"
      required: true
      review: "required"

signals:
  definitions:
    - key: "approved"
      type: "boolean"
      default: false

gates:
  definitions:
    - key: "settleable"
      rule: "checklist.required_accepted && signal.approved"
```

Model Integration
-----------------

[](#model-integration)

Add the `HasEnvelopes` trait to any model:

```
use LBHurtado\SettlementEnvelope\Traits\HasEnvelopes;

class Voucher extends Model
{
    use HasEnvelopes;
}

// Usage
$voucher->createEnvelope('bank.home-loan-takeout');
$voucher->isEnvelopeSettleable();
```

Events
------

[](#events)

The package fires the following events:

- `EnvelopeCreated`
- `PayloadUpdated`
- `AttachmentUploaded`
- `AttachmentReviewed`
- `SignalChanged`
- `GateChanged`

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance85

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

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

Every ~3 days

Total

6

Last Release

76d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/586e1ed70140038e6348728222adbcf68bfc4455b1f94a4f8bcbe57917a63d57?d=identicon)[3neti](/maintainers/3neti)

---

Top Contributors

[![3neti](https://avatars.githubusercontent.com/u/89447696?v=4)](https://github.com/3neti "3neti (5 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/3neti-settlement-envelope/health.svg)

```
[![Health](https://phpackages.com/badges/3neti-settlement-envelope/health.svg)](https://phpackages.com/packages/3neti-settlement-envelope)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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