PHP code example of kanekoelastic / codenberg-php

1. Go to this page and download the library: Download kanekoelastic/codenberg-php 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/ */

    

kanekoelastic / codenberg-php example snippets




ig = \Kanekoelastic\PhpCodenberg\Configuration::getInstance(
    'your-api-key',
    'your-secret-key'
);

try {
    // Get Access Token first
    $authApi = new \Kanekoelastic\PhpCodenberg\Api\AuthApi($config);
    $token = $authApi->getAccessToken();
    $config->setAccessToken($token->getAccessToken());

    // Then call API
    $templatesApi = new \Kanekoelastic\PhpCodenberg\Api\TemplatesApi($config);
    print_r($templatesApi->getTemplates());
} catch (Exception $e) {
    echo 'Exception when calling codenberg Api', $e->getMessage(), PHP_EOL;
}
bash
$ composer