PHPackages                             artisan-build/matte-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. artisan-build/matte-contracts

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

artisan-build/matte-contracts
=============================

The versioned contracts shared between matte-client and matte-server.

v2.1.0(1mo ago)03302MITPHPPHP ^8.3

Since Jun 14Pushed 1mo agoCompare

[ Source](https://github.com/artisan-build/matte-contracts)[ Packagist](https://packagist.org/packages/artisan-build/matte-contracts)[ RSS](/packages/artisan-build-matte-contracts/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (5)Used By (2)

matte-contracts
===============

[](#matte-contracts)

The versioned **HTTP wire protocol** shared between [`matte-client`](https://github.com/artisan-build/matte-client) (the send side) and [`matte-server`](https://github.com/artisan-build/matte-server) (the receive side) of [Matte](https://github.com/artisan-build/matte) — **self-hosted, unmetered image background removal on Laravel Cloud.**

This package is tiny and deliberately so. It has **zero Laravel dependencies** — just typed PHP 8 DTOs, the enums, and the `ENVELOPE_VERSION` constant. It is the **single place Matte's wire compatibility lives**, and because Matte's server is a plain HTTP API, it doubles as a **public contract**: any consumer in any language can implement against it.

> **Read-only mirror.** This repository is a read-only split of the [`artisan-build/matte`](https://github.com/artisan-build/matte) monorepo. Issues and pull requests are disabled here — please open them on the monorepo.

Why a separate package
----------------------

[](#why-a-separate-package)

Across many independently-deployed consumers and one self-hosted server, **version skew is the normal state, not an error.** You cannot keep them in lockstep, so the protocol is built to tolerate skew, and the contract that defines it lives in exactly one place that both sides pin. Keeping it framework-free means the wire shapes don't drag the Laravel runtime into a non-Laravel consumer.

The compatibility rules
-----------------------

[](#the-compatibility-rules)

1. **The envelope carries its own version.** Every payload includes `ENVELOPE_VERSION`.
2. **Additive within a major.** New fields are optional and added; existing fields are never removed or repurposed. That one rule is what lets a newer server parse every older envelope.
3. **A version newer than the server fails loud.** The server returns a clear **4xx** for an envelope it doesn't understand yet — "your client is ahead of this Matte instance."
4. **The image bytes are opaque.** They cross the wire as multipart, never inside the envelope; only the thin options/status metadata is version-sensitive.
5. **A major bump is a deliberate act** — an explicit `composer require`, never a routine `composer update`. `matte-client` pins a caret constraint (`^X`) on this package.

The envelopes (shape)
---------------------

[](#the-envelopes-shape)

**Submit** (`POST /v1/remove`): the image is sent as multipart bytes; this envelope is the options/metadata beside it.

FieldMeaning`envelope_version`The `ENVELOPE_VERSION` the client was built against.`options.mode``ml` or `grabcut`.`options.preset``fast` | `balanced` | `quality`.`options.model` / `edge_mode` / `iterations` / `margin`Optional tuning.`idempotency_key` / `callback_url`Optional.**Status** (`GET /v1/jobs/{id}`):

FieldMeaning`envelope_version`The server's envelope major.`job_id`The job identifier.`status``queued` | `processing` | `done` | `failed`.`output_ref`Storage key of the transparent PNG (when done).`error`Failure reason (when failed).The package ships these as readonly DTOs (`RemovalRequest`, `RemovalOptions`, `JobStatusEnvelope`), the backing enums (`Mode`, `Preset`, `EdgeMode`, `JobStatus`), a `Protocol` version helper, and an `InvalidEnvelope` exception — with tolerant `fromArray`(ignores unknown keys, defaults absent ones).

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

[](#installation)

```
composer require artisan-build/matte-contracts
```

You usually don't install this directly — it arrives as a dependency of `matte-client` or `matte-server`.

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance91

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~0 days

Total

4

Last Release

44d ago

Major Versions

v0.1.0 → v1.0.02026-06-14

v1.0.0 → v2.0.02026-06-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1053395?v=4)[Ed Grosvenor](/maintainers/edgrosvenor)[@edgrosvenor](https://github.com/edgrosvenor)

---

Top Contributors

[![edgrosvenor](https://avatars.githubusercontent.com/u/1053395?v=4)](https://github.com/edgrosvenor "edgrosvenor (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

contractslaravelmatte

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/artisan-build-matte-contracts/health.svg)

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

###  Alternatives

[nunomaduro/laravel-pot

Set of commands to inspect Laravel's container

1001.6k](/packages/nunomaduro-laravel-pot)

PHPackages © 2026

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