PHP code example of keboola / git-service-api-client

1. Go to this page and download the library: Download keboola/git-service-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

keboola / git-service-api-client example snippets


use Keboola\GitServiceApiClient\ApiClientConfiguration;
use Keboola\GitServiceApiClient\Auth\KeboolaServiceAccountAuth;
use Keboola\GitServiceApiClient\Auth\ManageApiTokenAuth;
use Keboola\GitServiceApiClient\GitServiceApiClient;

// Default: projected Kubernetes ServiceAccount token from
// /var/run/secrets/connection.keboola.com/serviceaccount/token, re-read on
// every request so kubelet-rotated tokens are picked up automatically.
$client = new GitServiceApiClient('https://git-service.example.com');

// Manage API token (legacy)
$client = new GitServiceApiClient(
    'https://git-service.example.com',
    new ApiClientConfiguration(auth: new ManageApiTokenAuth($manageApiToken)),
);

// SA token from a non-default mount path
$client = new GitServiceApiClient(
    'https://git-service.example.com',
    new ApiClientConfiguration(
        auth: new KeboolaServiceAccountAuth('/var/run/secrets/tokens/connection-token'),
    ),
);