There seems to be no way to do this in Composer, but it can be hacked.
In your composer.json file, put a comment where you want to hack some data.
{ "name": "base-reality/intahwebz", "//": "LOCALHACK", "require":{ "base-reality/php-to-javascript": ">=0.1.17", "guzzle/danackguzzle": "3.3.*@dev", ... ... } ... }
Then add a separate composer.local file (not tied to Git) that contains links to local directories:
"LOCALHACK", "repositories": [ { "type": "vcs", "url": "/documents/projects/github/intahwebz-core" } ],
Add a tiny PHP script called composerLocal.php to generate a new composer.json file
<?php $srcFile = file_get_contents("composer.json"); $hackFile = file_get_contents("composer.local"); $finalString = str_replace('"LOCALHACK",', $hackFile, $srcFile); file_put_contents("composer.json", $finalString); ?>
And a little bash script called localupdate.sh to backup the real composer.json file, generate a hacked composer.json, run Composer and then restore the original composer.json file
cp -f composer.json composer.json.bak php composerLocal.php composer update cp -f composer.json.bak composer.json
Running the localupdate.sh script allows you to test commits locally without jeopardizing a change to the actual composer.json file used by the project, so there is a chance of accidentally clicking an invalid .json composer in the repository.
To notice, Composer does not read files from the repository directory, it reads the registered files in Git, so you need to commit the changes made to the library code. The above process simply skips the click step.