Composer, Viaduct & GitHub API Limits

Unlike most package managers, the team behind Composer have opted for a system which, by default, relies upon talking directly to the GitHub API. Unfortunately, GitHub impose a rate limit on their API which means occasionally you may receive an error from composer asking you to login with your GitHub credentials.

Composer

There are two ways to resolve this issue on Viaduct - you can choose either of them.

Prefer Source

The first option is simply to adjust your composer command to include --prefer-source which means that it will use Git itself to fetch dependencies rather than then GitHub API. The final command will look something like this:

composer --prefer-source --no-interaction  

Add a GitHub API Key

As an alternative, you can provide composer with an OAuth token which will grant you your own rate limit rather than using one shared by all Viaduct users.

  1. Login to your GitHub account.

  2. Go to your Settings page and choose Applications.

  3. Under the Personal Access Tokens section, select Generate New Token.

  4. Enter a description (something like Viaduct) and you don't need any of the scopes to be selected.

    Screenshot

  5. Add a new build command (at the top of the list) to run composer config -g github-oauth.github.com <oauthtoken>. Be sure to replace <oauthtoken> with the token provided by GitHub.

    Screenshot

  6. Re-deploy your application.

Viaduct is a revolutionary new hosting platform

Our complete application hosting platform allows you to easily host your Ruby, PHP & Node.js apps on our fast & flexible cloud infrastructure. Plus, we monitor everything and ensure your site is always online.