Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit fc38bad

Browse files
committed
Added more information about project installed
1 parent e0b7ebf commit fc38bad

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

src/Symfony/Installer/NewCommand.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Symfony\Component\Console\Input\InputInterface;
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use Symfony\Component\Filesystem\Filesystem;
16+
use Symfony\Component\Process\PhpExecutableFinder;
17+
use Symfony\Component\Process\Process;
1618

1719
/**
1820
* This command creates new Symfony projects for the given Symfony version.
@@ -294,15 +296,17 @@ private function displayInstallationResult()
294296
{
295297
if (empty($this->requirementsErrors)) {
296298
$this->output->writeln(sprintf(
297-
" <info>%s</info> Symfony was <info>successfully installed</info>. Now you can:\n",
298-
defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : ''
299+
" <info>%s</info> Symfony %s was <info>successfully installed</info>. Now you can:\n",
300+
defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '',
301+
$this->getInstalledSymfonyVersion()
299302
));
300303
} else {
301304
$this->output->writeln(sprintf(
302-
" <comment>%s</comment> Symfony was <info>successfully installed</info> but your system doesn't meet its\n".
305+
" <comment>%s</comment> Symfony %s was <info>successfully installed</info> but your system doesn't meet its\n".
303306
" technical requirements! Fix the following issues before executing\n".
304307
" your Symfony application:\n",
305-
defined('PHP_WINDOWS_VERSION_BUILD') ? 'FAILED' : ''
308+
defined('PHP_WINDOWS_VERSION_BUILD') ? 'FAILED' : '',
309+
$this->getInstalledSymfonyVersion()
306310
));
307311

308312
foreach ($this->requirementsErrors as $helpText) {
@@ -318,13 +322,13 @@ private function displayInstallationResult()
318322
}
319323

320324
$this->output->writeln(sprintf(
321-
" * Change your current directory to %s.\n".
325+
" * Change your current directory to <comment>%s</comment>\n\n".
322326
" * Configure your application in <comment>app/config/parameters.yml</comment> file.\n\n".
323327
" * Run your application:\n".
324328
" 1. Execute the <comment>php app/console server:run</comment> command.\n".
325329
" 2. Browse to the <comment>http://localhost:8000</comment> URL.\n\n".
326330
" * Read the documentation at <comment>http://symfony.com/doc</comment>\n",
327-
$this->projectName
331+
$this->projectDir
328332
));
329333

330334
return $this;
@@ -378,4 +382,22 @@ private function getErrorMessage(\Requirement $requirement, $lineSize = 70)
378382

379383
return $errorMessage;
380384
}
385+
386+
/**
387+
* It returns the full Symfony version number of the project by executing
388+
* the '$ ./app/console --version' command, which outputs the following:
389+
* Symfony version X.Y.Z - app/dev/debug
390+
*/
391+
private function getInstalledSymfonyVersion()
392+
{
393+
$composer = json_decode(file_get_contents($this->projectDir.'/composer.lock'), true);
394+
395+
foreach ($composer['packages'] as $package) {
396+
if ('symfony/symfony' !== $package['name']) {
397+
continue;
398+
}
399+
400+
return $package['version'];
401+
}
402+
}
381403
}

0 commit comments

Comments
 (0)