flex / gitea
1.0.6
2023-08-03 11:59 UTC
Requires
- php: ^7.2|^8.0
- guzzlehttp/guzzle: ^7.3
README
此软件包为Gittea API 版本 1 提供了 API 客户端。
入门
先决条件
此软件包有以下要求
- PHP 7.2
安装
通过 composer 安装最新版本
composer require avency/gitea
基本用法
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
// - - - - -
// Create client and authenticate
$giteaClient = new Avency\Gitea\Client(
'https://gitea.yourdomain.com',
[
'type' => Avency\Gitea\Client::AUTH_TOKEN,
'auth' => 'your-auth-token'
]
);
or
$giteaClient = new Avency\Gitea\Client(
'https://gitea.yourdomain.com',
[
'type' => Avency\Gitea\Client::AUTH_BASIC_AUTH,
'auth' => [
'username' => 'your-username',
'password' => 'your-password',
]
]
);
// - - - - -
// Get a single repository
$repository = $giteaClient->repositories()->get('owner', 'repoName');
// Get version
$repository = $giteaClient->miscellaneous()->version();
以其他用户身份运行 API 调用
// e.g. check subscription status as a user
$status = $giteaClient->sudo('username')->repositories()->checkSubscription();
版本控制
我们使用SemVer进行版本控制。有关可用版本,请参阅此存储库的标签。
作者
- Michael Gerdemann - avency GmbH
请参阅参与此项目的贡献者列表。
许可证
本项目采用MIT许可证 - 有关详细信息,请参阅LICENSE.md文件。