Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Repository Contents

Shea Lewis edited this page Jun 2, 2015 · 2 revisions

Get Contents

Github::repo()->contents->show($owner, $repository, $path, $reference);

This method returns the contents of a file or directory in a repository.

Parameters

  • $owner (string) User or organization slug. Required.
  • $repository (string) Repository slug. Required.
  • $path (string) Path to the file in relation to the repository. Required.
  • $reference (string) A specific commit reference to pull the file from. Optional.

Returns

mixed

Example

Github::repo()->contents()->download('caffeinated', 'github', 'README.md');

Download a File

Github::repo()->contents()->download($owner, $repository, $path, $reference);

Downloads the given file from GitHub.

Parameters

  • $owner (string) User or organization slug. Required.
  • $repository (string) Repository slug. Required.
  • $path (string) Path to the file in relation to the repository. Required.
  • $reference (string) A specific commit reference to pull the file from. Optional.

Returns

mixed

Example

Github::repo()->contents()->download('caffeinated', 'github', 'README.md');

Get Archive Link

Github::repo()->contents()->archive($owner, $repository, $format, $reference)

This method will return a 302 to a URL to download a tarball or zipball archive for a repository.

Parameters

  • $owner (string) User or organization slug. Required.
  • $repository (string) Repository slug. Required.
  • $format (string) Format to return archive in, can be tarball or zipball. Optional, as it defaults to tarball.
  • $reference (string) A specific commit reference to pull the file from. Optional.

Returns

mixed

Example

GitHub::repo()->contents()->archive('caffeinated', 'github', 'zipball', 'master');