Category Archives: Composer

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": "", 
    "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

See the required PHP version for all your Composer dependencies

After building a project using Composer, you might ask yourself what the lowest supported PHP version amongst all the included libraries is. The highest number would also be the the minimum version PHP version that the project would run on.

To quickly check this in composer, run this from the project root:

composer show -i -t | grep -o "\-\-\(ext-\|php\).\+" | sort | uniq | cut -d- -f3-

Your output might look something like this:

php >=5.3.0
php >=5.3.9
php ^5.5 || ^7.0
php >=5.5.9

By checking the list of versions, we can see that 5.5.9 would be the lowest PHP version we would need to run this project.

Snippet source