Last active
August 29, 2015 14:23
-
-
Save AydinHassan/fe4abe834d3f144970d9 to your computer and use it in GitHub Desktop.
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 | |
if (file_exists('composer')) { | |
unlink('composer'); | |
} | |
file_put_contents('composer', file_get_contents('https://getcomposer.org/download/1.0.0-alpha10/composer.phar')); | |
chmod('composer', 0777); | |
file_put_contents('composer.json', <<<EOF | |
{ | |
"name": "test/test", | |
"require": { | |
"symfony/console": "^2.7" | |
} | |
} | |
EOF | |
); | |
$descriptorSpec = array( | |
0 => array("pipe", "r"), | |
1 => array("pipe", "w"), | |
2 => array("pipe", "w") | |
); | |
$process = proc_open('composer update', $descriptorSpec, $pipes, getcwd()); | |
foreach ($pipes as $pipe) { | |
var_dump(stream_get_contents($pipe)); | |
} | |
unlink('composer.json'); | |
unlink('composer'); | |
//OUTPUT: | |
//php test-composer-output.php | |
//string(0) "" | |
//string(0) "" | |
//string(156) "Loading composer repositories with package information | |
//Updating dependencies (including require-dev) | |
//Nothing to install or update | |
//Generating autoload files | |
//" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment