What is .evn file & Why we use .evn file in laravel?

Posted by

Laravel’s default .env file contains some common configuration values that may differ based on whether your application is running locally or on a production web server. These values are then retrieved from various Laravel configuration files within the config directory using Laravel’s env function.

By default, the .env file includes following parameters

APP_ENV = local
APP_DEBUG = true
APP_KEY = base64:ZPt2wmKE/X4eEhrzJU6XX4R93rCwYG8E2f8QUA7kGK8 =
APP_URL = http://localhost
DB_CONNECTION = mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306
DB_DATABASE = homestead
DB_USERNAME = homestead
DB_PASSWORD = secret
CACHE_DRIVER = file
SESSION_DRIVER = file
QUEUE_DRIVER = sync
REDIS_HOST = 127.0.0.1
REDIS_PASSWORD = null
REDIS_PORT = 6379
MAIL_DRIVER = smtp
MAIL_HOST = mailtrap.ioMAIL_PORT = 2525
MAIL_USERNAME = null
MAIL_PASSWORD = null
MAIL_ENCRYPTION = null

note:

  • The .env file should not be committed to the application source control, since each developer or user has some predefined environment configuration for the web application.
  • For backup options, the development team should include the .env.example file, which should contain the default configuration.

Where is the .env file located

Starting from v1.28 , the .env file is placed at the base of the project directory. Project directory can be explicitly defined with the –file option or COMPOSE_FILE environment variable. Otherwise, it is the current working directory where the docker compose command is executed ( v1.28 )

guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x