Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the environment using the Symfony console tool?

I use the Symfony CLI tool and I'm looking for a way to check the environment. I could not find anything like

$ php bin/console get environment

Is there another way for that? Is it possible / How to find out, which environment is currently active?


EDIT

The application is running in a concrete environment (and using then the app.php for prod or an app_{env} for any other environment).

So what I actually want to achieve is to find out, which environment is currently being used by the application (when the app is called via HTTP, e.g. in a browser).

like image 522
automatix Avatar asked Feb 08 '17 22:02

automatix


2 Answers

php bin/console about

This will display info about your app, one row will concern Environment:

enter image description here

like image 109
aga Avatar answered Sep 22 '22 12:09

aga


What about

$this->getContainer()->getParameter('kernel.environment');

in ContainerAwareCommand?

like image 29
Michał G Avatar answered Sep 21 '22 12:09

Michał G