libriciel/vitam-api-php

Vitam 客户端

1.1.0 2022-08-29 14:50 UTC

This package is not auto-updated.

Last update: 2024-09-24 00:38:03 UTC


README

这是基于 php-github-api,由 KnpLabs 开发。

要求

  • PHP >= 8.1
  • PSR-17 实现
  • PSR-18 实现

vitam-api-php 客户端的基本用法

<?php

require_once __DIR__ . '/vendor/autoload.php';

$url = 'https://vitam.domain.tld';
$certPath = '/path/to/the/certificate.p12';
$certPassphrase = 'passphrase_of_the_certificate';
$sipPath = '/path/to/my/sip.tar';
// Tenant number: X-Tenant-Id in request headers
$tenantId = 0;
// Context: X-Context-Id in request headers
$context = 'WORKFLOW';

$guzzle = new GuzzleHttp\Client([
    'cert' => [
        $certPath,
        $certPassphrase,
    ],
]);

$vitamClient = VitamClient\Client::createWithHttpClient($guzzle, $url);

$ingest = $vitamClient->ingest();

$operationId = $ingest->create($tenantId, $sipPath, $context);
$atr = $ingest->getAtr($tenantId, $operationId);

$vitamClient 对象,您可以访问所有可用的 Vitam API 端点。