kanekoelastic / codenberg-php
此包已被弃用且不再维护。未建议替代包。
Codenberg API 的 PHP 封装
0.0.2
2018-01-22 05:35 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: 2.9.*
- phpunit/phpunit: 5.7.*
- squizlabs/php_codesniffer: 3.2.*
This package is not auto-updated.
Last update: 2021-09-18 12:42:37 UTC
README
codenberg-php
使用 PHP5 编写的 Codenberg API 简单封装
要求
- PHP >= 5.6
- Guzzle 库,
- (可选) PHPUnit 运行测试。
安装
通过 Composer
$ composer require kanekoelastic/codenberg-php dev-master
基本用法
<?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; } ?>
许可协议
codenberg-php
采用 Apache License 2.0 许可 - 详细信息请参阅 LICENSE 文件