ierusalim/github-repo-walk

用于GitHub仓库下载或比较的简单类

0.1.1 2017-06-29 17:57 UTC

This package is auto-updated.

Last update: 2024-09-05 19:11:12 UTC


README

用于从GitHub仓库下载文件的简单类。

_它不是“git”的包装器。使用api.github.com获取文件列表。

使用示例

namespace ierusalim\GitRepoWalk;

require 'GitRepoWalk.php'; // or require 'vendor/autoload.php';

$g = new GitRepoWalk();

$g->writeEnable(); // if skip it remote repository will be compare with local

//download all files from repository to local-path
$stat = $g->gitRepoWalk( 
    '<local path for repository>',
    'ierusalim/github-repo-walk' //git-user and repository in one string
);

print_r($stat);

结果:将此仓库的文件下载到 <本地仓库路径>

一些其他函数的示例

//Get repositories list for specified user:
$repo_list_arr = $g->getUserRepositoriesList('php-fig');

//Get information about repository 'user/repo'
$repo_info = $g->getRepositoryInfo('ierusalim/github-repo-walk');

//Get contacts from repository 'user/repo' (emails, names, roles)
$contacts = $g->getRepositoryContacts('ierusalim/github-repo-walk');

print_r($contacts);

//Get files list from repository
$files = $g->getRepoFilesList("ierusalim/github-repo-walk");
//show file names
foreach($files->tree as $file_obj) {
    echo $file_obj->path . "\t{$file_obj->size}\n";
}