Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer option to use alternative to composer.json?

Tags:

composer-php

I've just started using the Composer feature where you tell it to look at local directories for dependencies, so that you can develop a library and something that uses that library in parallel without having to push to git to update all the time, which is awesome. e.g.

"repositories": [
    {
        "type": "vcs",
        "url": "/documents/projects/github/guzzle"
    }
],

"require":{
    "guzzle/guzzle": "3.7.*@dev"
}

So when you do a composer update, Composer will pull in the version of Guzzle from the local directory, so you can test the code for a library in another application that uses that library without having to push to a repository between each code change.

However I just almost checked in the composer.json for my project with that set - which is obviously not going to work on anyone elses machine.

Is there anyway to tell composer to use a different file than composer.json, or other way to be able to tell composer to use local directories safely, without the high probability of accidentally committing a broken version of composer.json to your repository?

like image 831
Danack Avatar asked Jun 18 '13 17:06

Danack


1 Answers

Use the COMPOSER environment variable:

env COMPOSER=composer-dev.json composer install

It has actually been available since at least 2012.

like image 160
aross Avatar answered Nov 03 '22 01:11

aross