Disable GitHub API in Composer to improve speed

If you are using GitHub repositories in Composer, you might notice that it takes a long time to run composer update. This is because Composer uses the GitHub API in an effort to improve performance. Unfortunately, GitHub API is very slow and you might need hundreds of calls for a single repo, depending on the number of tags. You can disable this behaviour by specifying the undocumented no-api flag in Composer. In composer.json, add it like this:

{ 
    "type": "vcs", 
    "url": "git@github.com:user/repo.git", 
    "no-api" : true 
}

This will make Composer check out the repository via Git instead, usually improving composer update times by 2-3x.

Discussion on Reddit with more info on the technical details

More information regarding the no-api flag

The post Disable GitHub API in Composer to improve speed appeared first on Useful Snippets.