Composer/Satis and GitHub Rate Limits

Composer/Satis and GitHub Rate Limits – hit this issue today. 60 requests per hours is not so match when you use Composer to build a project few times or you try to build local package repo with Satis with empty composer cache.

Actually, I wonder, why I didn’t hit rate limits (introduced in October 2012) earlier with Continues Integration building project few times per hour. Possibly Composer cache saved the day (TTL of cache is about 6 months by default). But I see many request (or issues) over Internet about this issue… and spent couple of hours solving it today to achieve my goals.

One of the best solutions I’ve found: Alister Bulman – Avoiding Composer Being Rate-limited by Github and it works perfectly with Composer and failed with Satis (at least for now).

After few “var_dump” of Satis and Composer I’ve found that Composer reads “global” configuration file from “COMPOSER_HOME” directory (next time do some RTFM: COMPOSER_HOME/config.json) and merges with local project settings.

So, if you place your GitHub OAuth key, created by Alister Bulman instructions, into COMPOSER_HOME/config.json file – you won’t need to place it anywhere else until you hit 5000 limit.

Example of COMPOSER_HOME/config.json:

{
"config": {
"github-oauth": {
"github.com": "<your GitHub OAuth Key>"
}
}
}

From now my Composer and Satis works fine. Might help if you use Continues Integration servers.

More about COMPOSER_HOME directory.

Some obvious things learned hard way.