@@ -35,7 +35,19 @@ class AboutCommand extends ContainerAwareCommand
3535 */
3636 protected function configure ()
3737 {
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+ ;
3951 }
4052
4153 /**
@@ -48,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
4860 /** @var $kernel KernelInterface */
4961 $ kernel = $ this ->getApplication ()->getKernel ();
5062
51- $ io -> table ( array (), array (
63+ $ rows = array (
5264 array ('<info>Symfony</> ' ),
5365 new TableSeparator (),
5466 array ('Version ' , Kernel::VERSION ),
@@ -75,7 +87,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
7587 array ('OPcache ' , extension_loaded ('Zend OPcache ' ) && ini_get ('opcache.enable ' ) ? 'true ' : 'false ' ),
7688 array ('APCu ' , extension_loaded ('apcu ' ) && ini_get ('apc.enabled ' ) ? 'true ' : 'false ' ),
7789 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 );
79103 }
80104
81105 private static function formatPath ($ path , $ baseDir = null )
@@ -103,4 +127,16 @@ private static function isExpired($date)
103127
104128 return false !== $ date && new \DateTime () > $ date ->modify ('last day of this month 23:59:59 ' );
105129 }
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+ }
106142}
0 commit comments