List of Laravel environments types List of Laravel environments types laravel laravel

List of Laravel environments types


The only values that mean anything to the framework are production, testing, and local.

When your environment is production, this just adds a little extra protection to some artisan commands (e.g. migrating, seeding). When in production, these commands must be run with the --force option.

When your environment is testing, this makes App::runningUnitTests() return true. This is used to disable verifying CSRF tokens when running phpunit tests. The default phpunit.xml file in Laravel sets the environment to testing.

When your environment is local, this makes App::isLocal() return true. This function is not actually used anywhere, unless you've used it yourself.

As you can see, you're free to set the environment value to whatever you want, with minimal consequences. If you don't use production, it is slightly easier to accidentally run a damaging artisan command you didn't want. If you don't use testing, you might have an issue with CSRF tokens with your phpunit feature tests. If you don't use local, this will only affect you if you already have custom code that depends on the local environment.

One other side note regarding the environment: as of Laravel 5.2.13, you can have different .env files for different environments. Laravel will first look for the .env.{environment} file, and if it doesn't exist, will then just load the default .env file.

So, for example, you could create a .env.testing file that will be used by your phpunit tests (since they use the testing environment), and it could live right next to your .env or .env.local file that is used when you're developing or manually testing the site.


You can change production. Or local by changing the value of APP_DEBUGER :TRUE/FALSEFalse means production. True means local.

You can add as many environment variable as u want it will not cause any problem. Environment mainly for storing credentials which is use by the application