@@ -35,7 +35,19 @@ class AboutCommand extends ContainerAwareCommand
35
35
*/
36
36
protected function configure ()
37
37
{
38
- $ this ->setDescription ('Displays information about the current project ' );
38
+ $ this
39
+ ->setDescription ('Displays information about the current project ' )
40
+ ->setHelp (<<<'EOT'
41
+ The <info>%command.name%</info> command displays information about the current Symfony project.
42
+
43
+ The <info>PHP</info> section displays important configuration that could affect your application. The values might
44
+ be different between web and CLI.
45
+
46
+ The <info>Environment</info> section displays the current environment variables managed by Symfony Dotenv. It will not
47
+ be shown if no variables were found. The values might be different between web and CLI.
48
+ EOT
49
+ )
50
+ ;
39
51
}
40
52
41
53
/**
@@ -48,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
48
60
/** @var $kernel KernelInterface */
49
61
$ kernel = $ this ->getApplication ()->getKernel ();
50
62
51
- $ io -> table ( array (), array (
63
+ $ rows = array (
52
64
array ('<info>Symfony</> ' ),
53
65
new TableSeparator (),
54
66
array ('Version ' , Kernel::VERSION ),
@@ -75,7 +87,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
75
87
array ('OPcache ' , extension_loaded ('Zend OPcache ' ) && ini_get ('opcache.enable ' ) ? 'true ' : 'false ' ),
76
88
array ('APCu ' , extension_loaded ('apcu ' ) && ini_get ('apc.enabled ' ) ? 'true ' : 'false ' ),
77
89
array ('Xdebug ' , extension_loaded ('xdebug ' ) ? 'true ' : 'false ' ),
78
- ));
90
+ );
91
+
92
+ if ($ dotenv = self ::getDotEnvVars ()) {
93
+ $ rows = array_merge ($ rows , array (
94
+ new TableSeparator (),
95
+ array ('<info>Environment (.env)</> ' ),
96
+ new TableSeparator (),
97
+ ), array_map (function ($ value , $ name ) {
98
+ return array ($ name , $ value );
99
+ }, $ dotenv , array_keys ($ dotenv )));
100
+ }
101
+
102
+ $ io ->table (array (), $ rows );
79
103
}
80
104
81
105
private static function formatPath ($ path , $ baseDir = null )
@@ -103,4 +127,16 @@ private static function isExpired($date)
103
127
104
128
return false !== $ date && new \DateTime () > $ date ->modify ('last day of this month 23:59:59 ' );
105
129
}
130
+
131
+ private static function getDotEnvVars ()
132
+ {
133
+ $ vars = array ();
134
+ foreach (explode (', ' , getenv ('SYMFONY_DOTENV_VARS ' )) as $ name ) {
135
+ if ('' !== $ name && false !== $ value = getenv ($ name )) {
136
+ $ vars [$ name ] = $ value ;
137
+ }
138
+ }
139
+
140
+ return $ vars ;
141
+ }
106
142
}
0 commit comments