-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
37 lines (28 loc) · 910 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
use Composer\Console\HtmlOutputFormatter;
use Symfony\Component\Console\Output\StreamOutput;
echo "<pre>";
$path = __DIR__ . '/core/components/guzzle7/';
putenv("COMPOSER={$path}composer.json");
putenv("COMPOSER_HOME={$path}.composer");
putenv("COMPOSER_VENDOR_DIR={$path}vendor/");
chdir($path);
require "phar://{$path}composer.phar/vendor/autoload.php";
$io = new \Composer\IO\BufferIO('', StreamOutput::VERBOSITY_NORMAL, new HtmlOutputFormatter());
$composer = \Composer\Factory::create($io);
$install = \Composer\Installer::create($io, $composer);
$install
->setPreferDist(true)
->setDevMode(false)
->setOptimizeAutoloader(true)
->setUpdate(true)
->setPreferStable(true);
try {
$install->run();
} catch (Exception $e) {
echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
$output = $io->getOutput();
$output = trim($output);
var_dump($output);
echo "Done!\n";