diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
index f49eb6dbc2dd..49fd03165a5b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -59,6 +59,7 @@ CHANGELOG
and `YamlLintCommand` classes have been marked as final
* Added `asset.request_context.base_path` and `asset.request_context.secure` parameters
to provide a default request context in case the stack is empty (similar to `router.request_context.*` parameters)
+ * Display environment variables managed by `Dotenv` in `AboutCommand`
3.3.0
-----
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
index 4a594d3ae70c..3c5ba3e93d3c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
@@ -35,7 +35,19 @@ class AboutCommand extends ContainerAwareCommand
*/
protected function configure()
{
- $this->setDescription('Displays information about the current project');
+ $this
+ ->setDescription('Displays information about the current project')
+ ->setHelp(<<<'EOT'
+The %command.name% command displays information about the current Symfony project.
+
+The PHP section displays important configuration that could affect your application. The values might
+be different between web and CLI.
+
+The Environment section displays the current environment variables managed by Symfony Dotenv. It will not
+be shown if no variables were found. The values might be different between web and CLI.
+EOT
+ )
+ ;
}
/**
@@ -48,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
/** @var $kernel KernelInterface */
$kernel = $this->getApplication()->getKernel();
- $io->table(array(), array(
+ $rows = array(
array('Symfony>'),
new TableSeparator(),
array('Version', Kernel::VERSION),
@@ -75,7 +87,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
array('OPcache', extension_loaded('Zend OPcache') && ini_get('opcache.enable') ? 'true' : 'false'),
array('APCu', extension_loaded('apcu') && ini_get('apc.enabled') ? 'true' : 'false'),
array('Xdebug', extension_loaded('xdebug') ? 'true' : 'false'),
- ));
+ );
+
+ if ($dotenv = self::getDotEnvVars()) {
+ $rows = array_merge($rows, array(
+ new TableSeparator(),
+ array('Environment (.env)>'),
+ new TableSeparator(),
+ ), array_map(function ($value, $name) {
+ return array($name, $value);
+ }, $dotenv, array_keys($dotenv)));
+ }
+
+ $io->table(array(), $rows);
}
private static function formatPath($path, $baseDir = null)
@@ -103,4 +127,16 @@ private static function isExpired($date)
return false !== $date && new \DateTime() > $date->modify('last day of this month 23:59:59');
}
+
+ private static function getDotEnvVars()
+ {
+ $vars = array();
+ foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
+ if ('' !== $name && false !== $value = getenv($name)) {
+ $vars[$name] = $value;
+ }
+ }
+
+ return $vars;
+ }
}