sebwite / git
Github/Bitbucket api with equal interface and flysystem.
Requires
- php: >=5.5.9
- gentle/bitbucket-api: 0.7.*
- graham-campbell/github: ~4.2
- guzzlehttp/guzzle: ~6.2
- potherca/flysystem-github: 0.2.*
- sebwite/support: 2.0.*
- vierbergenlars/php-semver: ~3.0
Requires (Dev)
- sebwite/phing: 1.0.*
- sebwite/testing: 1.0.*
This package is auto-updated.
Last update: 2024-11-17 10:03:44 UTC
README
The sebwite/git
package provides seemless switching between github
and bitbucket
API calls and filesystem operations.
Created for the Laravel 5 framework.
The package follows the FIG standards PSR-1, PSR-2, and PSR-4 to ensure a high level of interoperability between shared PHP code.
Quick Overview
For the full documenation, check out the sebwite-git package documenatation.
Configuration
Define your connections in config/services.php
.
return [
'conn1' => [
'driver' => 'bitbucket', // bitbucket | github
'auth' => Sebwite\Git\Manager::AUTH_BASIC,
'username' => 'user1',
'password' => 'passwd'
],
'conn2' => [
'driver' => 'bitbucket', // bitbucket | github
'auth' => Sebwite\Git\Manager::AUTH_OAUTH,
'key' => 'a#W23r2baaaf',
'secret' => 'we8r9w1ef32f'
],
'conn3' => [
'driver' => 'github', // bitbucket | github
'auth' => Sebwite\Git\Manager::AUTH_TOKEN,
'secret' => 'asAER4562aw32po'
]
];
Filesystem
$fs = Git::getFilesystem($repo, $owner = null, $ref = null);
$fs->exists('composer.json');
$com = $fs->get('composer.json');
// the other Flysystem methods yo are most likely familiar with..
API calls
Git::getUser();
Git::getUsername();
Git::listWebhooks($repo, $owner = null);
Git::getWebhook($repo, $uuid, $owner = null);
Git::createWebhook($repo, array $data, $owner = null);
Git::removeWebhook($repo, $uuid, $owner = null);
Git::listOrganisations($owner = null);
Git::listRepositories($owner = null);
Git::createRepository($repo, array $data = [ ], $owner = null);
Git::deleteRepository($repo, $owner = null);
Git::getBranches($repo, $owner = null);
Git::getMainBranch($repo, $owner = null);
Git::getRepositoryManifest($repo, $ref, $owner = null);
Git::getTags($repo, $owner = null);
Git::getRaw($repo, $ref, $path, $owner = null);
Git::getChangeset($repo, $ref, $path, $owner = null);
Git::getRepositoryCommits($repo, $owner = null);
Git::getBranchCommits($repo, $branch, $owner = null);
Transformers
Transformers are responsible for transforming the raw api call response data into a common, similar response.
If wanted, you can extend and use your own implementation. Also provided is a NullTransformer
which won't transform anything.
Git::setTransformer(NullTransformer::class);
Git::setTransformer(BitbucketTransformer::class);
Git::setTransformer(GithubTransformer::class);