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

2 thoughts on “Disable GitHub API in Composer to improve speed

  1. Justin

    So you can only do this for private repos? or is there also an undocumented cli flag that would prefer no-api for all the things?

    1. Stanislav Khromov Post author

      You can do this for any GitHub repo, public or private. But you have to configure the `no-api` flag for each repo in your `composer.json` file.


Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.