artisan-build/matte-client
Composer 安装命令:
composer require artisan-build/matte-client
包简介
The client-side Matte package installed in consuming Laravel applications.
README 文档
README
The send side of Matte — self-hosted, unmetered
image background removal on Laravel Cloud. Install it in any Laravel app to call your
self-hosted Matte server with one line: Matte::remove($image).
Read-only mirror. This repository is a read-only split of the
artisan-build/mattemonorepo. Issues and pull requests are disabled here — please open them on the monorepo.
What it does
matte-client is a thin convenience SDK over the Matte HTTP API. It is a fast-path, not a
requirement — the server is a plain HTTP API, so anything can POST to it directly. The SDK
just makes the common Laravel case ergonomic.
Matte::remove($image, $options, $callbackUrl?)→ aJobHandle(async submit). The$imagecan be a file path, raw bytes, anUploadedFile, or anSplFileInfo.Matte::removeSync($image, $options)→ the transparent PNG bytes, inline, for small / interactive cases.JobHandle→status(),wait($timeout)(polls to done/failed/timeout),result()(fetches the PNG).
It speaks the matte-contracts wire
protocol and authenticates with a Bearer token.
Async, two ways — simple by default
The default keeps the install zero-infrastructure: no public endpoint, no websockets.
- Poll → event (default). Submit, then
AwaitRemovalJob::dispatch($handle->id()). The job polls the server on your app's own queue, optionally stores the result toMATTE_STORE_DISK, and fires aMatteRemovalCompletedevent you listen for. Works everywhere — localhost, CI, behind a firewall. - Signed webhook (opt-in). Set
MATTE_WEBHOOK_PATHand pass acallback_url; the package registers a receiver that verifies the server'sX-Matte-Signature(constant-time HMAC) and fires the sameMatteRemovalCompletedevent. Lower latency at scale, but needs a public URL.
use ArtisanBuild\MatteClient\Facades\Matte; use ArtisanBuild\MatteClient\Jobs\AwaitRemovalJob; $handle = Matte::remove($request->file('photo'), ['mode' => 'grabcut', 'preset' => 'quality']); AwaitRemovalJob::dispatch($handle->id()); // → MatteRemovalCompleted // or, inline: $png = Matte::removeSync($smallImage);
Activation — by presence of config
The client is active when MATTE_URL and MATTE_TOKEN are set. The webhook receiver is
registered only when MATTE_WEBHOOK_PATH is configured.
Installation
composer require artisan-build/matte-client php artisan matte:install
matte:install prompts for the Matte server URL and the API token (and an optional webhook
secret), writes MATTE_URL / MATTE_TOKEN / MATTE_WEBHOOK_SECRET to your .env, publishes
the config, and pins matte-contracts to a caret constraint. Generate the token on the server
with php artisan matte:issue-token <client-id>.
License
MIT. See LICENSE.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-14