libriciel/vitam-api-php

1.1.0 2022-08-29 14:50 UTC

This package is not auto-updated.

Last update: 2024-11-19 01:18:24 UTC


README

This is based on php-github-api by KnpLabs.

Requirements

Basic usage of vitam-api-php client

<?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);

From $vitamClient object, you have access to all available Vitam api endpoints.