ENV

When you're doing your magic, you will find that variables and constants are important components. There will be constants, variables and spells that you don't want exposed (e.g. contact numbers, domain manes, email addresses, passwords and URLS).

Tina4 uses a .env file to setup project constants, a .env will be created for you when the system runs for the first time. If you specify an environment variable on your OS called ENVIRONMENT then .env.ENVIRONMENT will be loaded instead.

Never include the .env file when uploading or hosting. A magician never reveals their secrets.

Example of a .env file:

   [Section]           #--> Group section, only for pretty env file
   MY_VAR=Test         #--> Example declaration
   SOMETHING="Hello"   #--> Other valid example SOMETHING will be Hello
   TEST_ARRAY=["ONE", "TWO", "THREE"] #--> Will not work on older version of PHP
   # A comment  starts with a hash symbol
   [Another Section]
   VERSION=1.0.0

Here's a more practical example of how it may look :

[SMTP Settings]
SMTP_SERVER=smtp.gmail.com
SMTP_USER=youremail@gmail.com
SMTP_PASSWORD=clancyGilroy
SMTP_PORT=465

It is important to save the variables / constants that you created, close your IDE tool and restart the program. This is to ensure that the variables / constants are safely applied throughout your project.

The .env file contains information that should not be committed to your source repository or constants & configurations you want to reference in your code. Make sure you protect this file if you have private information there. The default .htaccess file shipped with Tina4 prevents this for Apache based servers but you may want to configure differently if you use another environment.

Powered by ComboStrap