avency / gitea
Gitea API
Installs: 1 305
Dependents: 0
Suggesters: 0
Security: 0
Stars: 22
Watchers: 4
Forks: 11
Open Issues: 2
Requires
- php: ^7.2
- guzzlehttp/guzzle: ~6.0
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