定制 artisan-build/crate-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

artisan-build/crate-client

Composer 安装命令:

composer require artisan-build/crate-client

包简介

The client package for Crate private Composer registry integrations.

README 文档

README

Client-side helpers for Crate.

This package has two surfaces:

  • Consumer auth helper: write Composer HTTP Basic auth for a Crate registry.
  • Issuer SDK: call a Crate deployment's admin-token gated /api/credentials endpoint.

Consumer Helper

Configure the customer app with the Crate registry URL and an issued registry credential:

CRATE_URL=https://crate.example.com
CRATE_TOKEN=issued-registry-credential

Generate Composer auth:

php artisan crate:auth

By default, crate:auth writes or merges auth.json in the current working directory. It adds this shape:

{
  "http-basic": {
    "crate.example.com": {
      "username": "token",
      "password": "issued-registry-credential"
    }
  }
}

Use a different path with --path:

php artisan crate:auth --path=/path/to/auth.json

Print the JSON instead of writing a file with --print, which is useful for COMPOSER_AUTH in CI:

export COMPOSER_AUTH="$(php artisan crate:auth --print)"

Then configure Composer to use the Crate registry and require packages normally:

composer config repositories.crate composer https://crate.example.com
composer require vendor/pkg

Issuer SDK

Use CrateIssuer in the operator's own Laravel app to issue and revoke credentials around billing, onboarding, or access logic that you own.

Configure the issuer client:

CRATE_ISSUER_URL=https://crate.example.com
CRATE_ADMIN_TOKEN=admin-ability-token
CRATE_ISSUER_RETRIES=2
CRATE_ISSUER_RETRY_SLEEP=100

CRATE_ISSUER_URL defaults to CRATE_URL when omitted.

Example:

use ArtisanBuild\CrateClient\CrateIssuer;

$issuer = CrateIssuer::fromConfig();

$credential = $issuer->issue('build-bot');
$tokens = $issuer->list();
$issuer->revoke('build-bot');

The SDK calls:

  • POST /api/credentials for issue(...), returning an ArtisanBuild\CrateContracts\Credential with plaintext shown once.
  • GET /api/credentials for list(), returning metadata without plaintext.
  • DELETE /api/credentials/{name} for revoke(...).

Requests use Bearer auth with the configured admin token, accept JSON, retry transient failures according to config, and throw on non-2xx responses.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固