-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e60dba0
commit 6f744ff
Showing
18 changed files
with
482 additions
and
104 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"repositories": [], | ||
"require": { | ||
"symfony/var-dumper": "^5.1" | ||
"php": "^7.4.14", | ||
"symfony/polyfill-php74": "^1.17", | ||
"symfony/var-dumper": "^5.2" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,24 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Starts a dump server to collect and output dumps on a single place with multiple formats support. | ||
* Proxy PHP file generated by Composer | ||
* | ||
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com> | ||
* This file includes the referenced bin path (../symfony/var-dumper/Resources/bin/var-dump-server) using eval to remove the shebang if present | ||
* | ||
* @generated | ||
*/ | ||
|
||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Logger\ConsoleLogger; | ||
use Symfony\Component\Console\Output\ConsoleOutput; | ||
use Symfony\Component\VarDumper\Command\ServerDumpCommand; | ||
use Symfony\Component\VarDumper\Server\DumpServer; | ||
|
||
function includeIfExists(string $file): bool | ||
{ | ||
return file_exists($file) && include $file; | ||
} | ||
|
||
if ( | ||
!includeIfExists(__DIR__ . '/../../../../autoload.php') && | ||
!includeIfExists(__DIR__ . '/../../vendor/autoload.php') && | ||
!includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php') | ||
) { | ||
fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL); | ||
exit(1); | ||
} | ||
|
||
if (!class_exists(Application::class)) { | ||
fwrite(STDERR, 'You need the "symfony/console" component in order to run the VarDumper server.'.PHP_EOL); | ||
exit(1); | ||
$binPath = realpath(__DIR__ . "/" . '../symfony/var-dumper/Resources/bin/var-dump-server'); | ||
$contents = file_get_contents($binPath); | ||
$contents = preg_replace('{^#!/.+\r?\n<\?(php)?}', '', $contents, 1, $replaced); | ||
if ($replaced) { | ||
$contents = strtr($contents, array( | ||
'__FILE__' => var_export($binPath, true), | ||
'__DIR__' => var_export(dirname($binPath), true), | ||
)); | ||
|
||
eval($contents); | ||
exit(0); | ||
} | ||
|
||
$input = new ArgvInput(); | ||
$output = new ConsoleOutput(); | ||
$defaultHost = '127.0.0.1:9912'; | ||
$host = $input->getParameterOption(['--host'], $_SERVER['VAR_DUMPER_SERVER'] ?? $defaultHost, true); | ||
$logger = interface_exists(LoggerInterface::class) ? new ConsoleLogger($output->getErrorOutput()) : null; | ||
|
||
$app = new Application(); | ||
|
||
$app->getDefinition()->addOption( | ||
new InputOption('--host', null, InputOption::VALUE_REQUIRED, 'The address the server should listen to', $defaultHost) | ||
); | ||
|
||
$app->add($command = new ServerDumpCommand(new DumpServer($host, $logger))) | ||
->getApplication() | ||
->setDefaultCommand($command->getName(), true) | ||
->run($input, $output) | ||
; | ||
include $binPath; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@ECHO OFF | ||
setlocal DISABLEDELAYEDEXPANSION | ||
SET BIN_TARGET=%~dp0/../symfony/var-dumper/Resources/bin/var-dump-server | ||
php "%BIN_TARGET%" %* |
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
Oops, something went wrong.