jbroadway/githubfetcher

一个非常简单的GitHub公共项目获取工具。

dev-master 2012-01-12 21:26 UTC

This package is auto-updated.

Last update: 2024-08-25 06:05:35 UTC


README

这是一个非常基础的GitHub公共项目获取工具。通过CURL使用GitHub API的v3版本。用于快速从GitHub获取项目,比完整的GitHub PHP客户端库要小得多。

用法

<?php

require 'GithubFetcher.php';

$github = new GithubFetcher ('git://github.com/codeguy/Slim.git');

// get all files/folders from the repository
$tree = $github->tree ();

$first_file = false

foreach ($tree as $item) {
	printf ("%s: %s\n", $item->type, $item->path);
	if (! $first_file && $item->type === 'blob') {
		$first_file = $item;
	}
}

// print the contents of the file
echo $github->get ($first_file);

?>