Created
February 16, 2017 17:32
-
-
Save gcphost/54fe54c04a5c5dc4de6011fecef93e81 to your computer and use it in GitHub Desktop.
Hack to replace repositories in composer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Remove Local Repositories | |
|-------------------------------------------------------------------------- | |
| | |
| This script will remove local repositories from the composer.json and | |
| replace them with the github version. | |
| | |
*/ | |
$composer = json_decode(file_get_contents('composer.json'), true); | |
file_put_contents('composer.json.bk', json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); | |
unset($composer['repositories']); | |
$composer['repositories'][] = [ | |
'type' => 'vcs', | |
'url' => 'https://github.com/../.git', | |
]; | |
unlink('composer.lock'); | |
echo 'Saving new composer.json.'.file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment