承接 artisan-build/matte-contracts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

artisan-build/matte-contracts

Composer 安装命令:

composer require artisan-build/matte-contracts

包简介

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

README 文档

README

The versioned HTTP wire protocol shared between matte-client (the send side) and matte-server (the receive side) of Matteself-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 monorepo. Issues and pull requests are disabled here — please open them on the monorepo.

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

  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)

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

Field Meaning
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}):

Field Meaning
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

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

MIT. See LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固