-
Notifications
You must be signed in to change notification settings - Fork 7
/
phpsu
executable file
·37 lines (31 loc) · 1.01 KB
/
phpsu
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
#!/usr/bin/env php
<?php
if (version_compare('7.2.0', PHP_VERSION, '>')) {
fwrite(STDERR, 'phpsu works only with php version >=7.2 your version is: ' . PHP_VERSION . PHP_EOL);
die();
}
call_user_func(function () {
$possibleAutoloadFiles = [
// php ./vendor/bin/phpsu
__DIR__ . '/../autoload.php',
// php ./bin/phpsu
__DIR__ . '/../vendor/autoload.php',
// php ./phpsu
__DIR__ . '/vendor/autoload.php',
// php ./vendor/phpsu/phpsu/phpsu may be symlinked from ./vendor/bin/phpsu
__DIR__ . '/../../autoload.php',
];
$firstVendorAutoloadFile = null;
foreach ($possibleAutoloadFiles as $file) {
if (file_exists($file)) {
$firstVendorAutoloadFile = $file;
break;
}
}
if (!$firstVendorAutoloadFile) {
fwrite(STDERR, 'phpsu could not find any autoload file' . PHP_EOL);
die();
}
require $firstVendorAutoloadFile;
\PHPSu\Cli\PhpsuApplication::createApplication()->run();
});