flex / gitea
Gitea API
1.0.7
2024-11-15 03:06 UTC
Requires
- php: ^7.2|^8.0
- guzzlehttp/guzzle: ^7.3
README
This package provides an API client for Gitea API Version 1.
Getting Started
Prerequisites
This package has the following requirements:
- PHP 7.2
Installing
Install latest version via composer:
composer require avency/gitea
Basic usage
// 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();
Run an API call as another user:
// e.g. check subscription status as a user
$status = $giteaClient->sudo('username')->repositories()->checkSubscription();
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Michael Gerdemann - avency GmbH
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details