kanekoelastic/codenberg-php

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP Wrapper for Codenberg API

0.0.2 2018-01-22 05:35 UTC

This package is not auto-updated.

Last update: 2021-09-18 12:42:37 UTC


README

codenberg-php

Build Status License

A simple wrapper for Codenberg API, written with PHP5.

Requirements

  • PHP >= 5.6
  • Guzzle library,
  • (optional) PHPUnit to run tests.

Install

Via Composer:

$ composer require kanekoelastic/codenberg-php dev-master

Basic usage

<?php

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

$config = \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;
}
?>

License

codenberg-php is licensed under the Apache License 2.0 - see the LICENSE file for details