Laravel 5: Startup – Configuration / Maintenance

Pretty much everything is clearly explained here.

But lets take a look some pointers, that should be pulled up, to let see things clearer.

You must remember to setup DATABASE access data in .env file.

For code completion you may use this file. Place it in Laravel app root folder, Do not push it to repository!

.env (in main catalog) file overrides information stored in your config files (folder: /config).
It is great for development purposes – just make sure you will not upload it to repo, or download any from repo (e.g. put there by some team member by mistake).

If you get this error in CLI:

… you forgot to edit your Database credentials in your .env file.

 

Configuration

  1. all config files are stored in /config dir
  2. accessing config value anywhere within Laravel powered app:

    where:
    app‘ is a config file name, and
    timezone‘ in config value
  3. setting config values at runtime (not in config file, but ad hoc):
  4. .env: startup configuration values (environment configuration)
    all .env values are loaded to PHP superglobal $_ENV
    env helper function is used to load to $_ENV, e.g. see config files
    env helper is used with default value, in case .env file does not have one, e.g.:

    value in .env file overrides helper function default file (false in given example)
    do not push to remository .env file, as your local devel configuration on .env may not suit online project
  5. configuration files catching:
    should be done for production ready version
    should NOT be used during development routine
    code (in terminal):

 


Maintenance

If you want to put your site in a stand-by, use this code:

If you want it live again, use this code: