Back to the "Repos API" | Back to the navigation
Wraps GitHub Repository Contents API.
You can read about references here.
https://docs.github.com/rest/repos/contents#get-a-repository-readme
$readme = $client->api('repo')->contents()->readme('KnpLabs', 'php-github-api', $reference);https://docs.github.com/rest/repos/contents#get-repository-content
$fileInfo = $client->api('repo')->contents()->show('KnpLabs', 'php-github-api', $path, $reference);$fileExists = $client->api('repo')->contents()->exists('KnpLabs', 'php-github-api', $path, $reference);https://docs.github.com/rest/repos/contents#create-or-update-file-contents
$committer = array('name' => 'KnpLabs', 'email' => 'info@knplabs.com');
$fileInfo = $client->api('repo')->contents()->create('KnpLabs', 'php-github-api', $path, $content, $commitMessage, $branch, $committer);https://docs.github.com/rest/repos/contents#create-or-update-file-contents
$committer = array('name' => 'KnpLabs', 'email' => 'info@knplabs.com');
$oldFile = $client->api('repo')->contents()->show('KnpLabs', 'php-github-api', $path, $branch);
$fileInfo = $client->api('repo')->contents()->update('KnpLabs', 'php-github-api', $path, $content, $commitMessage, $oldFile['sha'], $branch, $committer);https://docs.github.com/rest/repos/contents#delete-a-file
$committer = array('name' => 'KnpLabs', 'email' => 'info@knplabs.com');
$oldFile = $client->api('repo')->contents()->show('KnpLabs', 'php-github-api', $path, $branch);
$fileInfo = $client->api('repo')->contents()->rm('KnpLabs', 'php-github-api', $path, $commitMessage, $oldFile['sha'], $branch, $committer);https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar
$archive = $client->api('repo')->contents()->archive('KnpLabs', 'php-github-api', $format, $reference);$fileContent = $client->api('repo')->contents()->download('KnpLabs', 'php-github-api', $path, $reference);