What is the best practice for adding constants in laravel? (Long List)

后端 未结 11 757
猫巷女王i
猫巷女王i 2021-01-30 06:21

I am rather new to laravel. I have a basic question, What is the best way to add constants in laravel. I know the .env method that we use to add the constants. Also I have mad

11条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 06:53

    Your question was about the 'best practices' and you asked about the '.env method'.

    .env is only for variables that change because the environment changes. Examples of different environments: test, acceptance, production.

    So the .env contains database credentials, API keys, etc.

    The .env should (imho) never contain constants which are the same over all environments. Just use the suggested config files for that.

提交回复
热议问题