.env
file is a non-version-controlled file that can contain sensitive information such as settings and passwords. Laravel 5 comes with a .env.example
file to get things started. The way you use environment variables is by declaring them in the
.env
file, and then invoking them as such:'key' => env('VALUE', 'default')
'host' => env('DB_HOST', 'localhost')
Additionally, further configuration can be set in files in the
config
folder. For example, all the database connection information is set up in the config/databases.php
file. Everything in that folder is used to that extent, so be sure to have a peek there if you install any useful packages into your app.Laravel error pages also change what they display based on the environment. For example, the
APP_ENV
variable in the .env
file controls how your app interacts with the browser. If set to APP_ENV = local
, there will be much more verbose error pages (useful to a developer), as opposed to APP_ENV = production
, which will show only the more user-friendly "Whoops, looks like something went wrong."
message! Pretty useful stuff.
No comments :
Post a Comment