open-runtimes/sdk-for-php
Composer 安装命令:
composer require open-runtimes/sdk-for-php
包简介
PHP SDK for the Open Runtimes orchestrator Jobs API.
README 文档
README
PHP SDK for the Open Runtimes orchestrator Jobs API.
Server: https://github.com/open-runtimes/orchestrator
use OpenRuntimes\Orchestrator\Enum\CallbackEvent; use OpenRuntimes\Orchestrator\Jobs; use OpenRuntimes\Orchestrator\Model\Artifact\DownloadArtifact; use OpenRuntimes\Orchestrator\Model\Artifact\UploadArtifact; use OpenRuntimes\Orchestrator\Model\Callback; use Utopia\Client; use Utopia\Client\Adapter\Curl\Client as CurlAdapter; $http = new Client(new CurlAdapter()) ->withBaseUri('http://localhost:8080') ->withBearerAuth('secret'); $jobs = new Jobs($http); $response = $jobs->create( id: 'build-001', image: 'alpine:latest', command: 'sh -c "echo hello > /workspace/output.txt"', cpu: 0.5, memory: 512, timeoutSeconds: 300, artifacts: [ new DownloadArtifact('source', 'https://example.com/source.tar.gz', 'code.tar.gz'), new UploadArtifact('result', 'output.txt', 'https://example.com/upload', depends: 'job'), ], callback: new Callback( url: 'https://app.example.com/orchestrator/events', events: [CallbackEvent::Log, CallbackEvent::Artifact, CallbackEvent::Exit], key: 'webhook-secret', ), );
Jobs
$created = $jobs->create(id: 'build-001', image: 'alpine:latest', command: 'echo hello'); $status = $jobs->get('build-001'); $list = $jobs->list(); $jobs->delete('build-001');
Errors
API responses with status >= 400 throw ApiException with statusCode, raw body, and decoded JSON when available.
use OpenRuntimes\Orchestrator\Exception\ApiException; try { $jobs->get('missing'); } catch (ApiException $e) { echo $e->statusCode; echo $e->getMessage(); }
Callback Signatures
use OpenRuntimes\Orchestrator\Callback\Signature; $valid = Signature::verifyEvent($rawBody, $headers['x-signature-256'] ?? '', $secret);
Development
composer install
composer test
composer analyze
composer format:check
composer refactor:check
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-08