phpsymfonysymfony-cli

What is the "php=value" parameter used for in the 'symfony new' console command?


The output from symfony help new gives:

Description:
  Create a new Symfony project

Usage:
  symfony local:new [options] [--] [<directory>]

Arguments:
  directory  Directory of the project to create


Options:
  --dir=value      Project directory
  --version=value  The version of the Symfony skeleton (a version or one of "lts", "stable", "next", or "previous")
  --full           Use github.com/symfony/website-skeleton (deprecated, use --webapp instead)
  --demo           Use github.com/symfony/demo
  --webapp         Add the webapp pack to get a fully configured web project
  --api            Add the api pack to get a fully configured api project
  --book           Clone the Symfony: The Fast Track book project
  --docker         Enable Docker support
  --no-git         Do not initialize Git
  --upsun          Initialize Upsun configuration
  --cloud          Initialize Platform.sh configuration
  --debug          Display commands output
  --php=value      PHP version to use

What does the --php=value parameter do?

"PHP version to use" means what, exactly? Use where, and when?

Are these options documented in more detail online somewhere?


Solution

  • Basically, the only thing this option does is to create the file .php-version and populate it with your chosen value.

    That value will subsequently be used by the Symfony CLI to choose a different PHP runtime to execute commands, as described here.

    This PHP version will be used when running commands through the Symfony CLI wrapper (e.g. symfony console foo:bar), or even (as far as I can tell), as a runtime when using the Symfony CLI built-in server.