title: How to download a github repository or files with curl
body: <p>I have a success to download a repository from github via <code>file_get_content</code> but what is the orientation with curl.</p>
  
  <p>The advantage with the <code>file_get_content</code> it's like anonymous. In this case inside a backoffice, it's possible to download plugin in for example.</p>
  
  <p>But Github restrict this usage at less 10 times, after the user must to wait long time to restart something.</p>
  
  <p>It seems if the curl is used, github allow more access to download a respository.</p>
  
  <p>Do you have an example to use with curl (like anonymous)?</p>
  
  <p>Below an example that I make. It's works fine but it's not possible to use this several times. Think less 10 times.</p>
  
  <p>Thank you</p>
  
  <pre><code> public function __construct() {
    $this-&gt;githubUrl = 'https://github.com';
    $this-&gt;githubApi = 'https://api.github.com';
    $this-&gt;githubRepo = 'repos';
    $this-&gt;context = stream_context_create(array('http' =&gt; array('header' =&gt; 'User-Agent: ClicShopping',)));
    $this-&gt;githubRepoClicShoppingCore = 'CoreofApplication';
    $this-&gt;githubRepoName = 'addOnNameOfApplication';
  }
  
  private function getGithubRepo() {
    $url = $this-&gt;githubApi . '/' . $this-&gt;githubRepo . '/' . $this-&gt;githubRepoName;
    return $url;
  }
  
  private function getGithubCoreRepo() {
    $url = $this-&gt;githubApi . '/' . $this-&gt;githubRepo . '/' . $this-&gt;coreName . '/' . $this-&gt;githubRepoClicShoppingCore;
    return $url;
  }
  
  private function setContext() {
    return  $this-&gt;context;
  }
  
  private function getGithubApiClicShoppingCoreArchive() {
    $url = $this-&gt;githubUrl . '/'  .$this-&gt;coreName . '/' . $this-&gt;githubRepoClicShoppingCore.'/archive/master.zip';
    return $url;
  }
  </code></pre>
  
  <p>Thank you.</p>