Welcome to Trishul API Questions and Answers. Help and learn how to use it efficiently.
0 like 0 dislike
18 views
in App by (570 points)
As a developer, I am using TrishulApi for building my application. I want to connect the application with database. I have heard that putting some properties in .env file will automatically connect the application with database.

What are those properties?

1 Answer

0 like 0 dislike
by (570 points)
edited by
 
Best answer

Welcome developers, 

TrishulAPI is lightweight, and a complete framework. It has many ready to use components. 

If you want to use database in your application, you need not to write complex code for that purpose. Just define some properties in .env file. 

Properties for Database Connection: 

DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=shyam
DB_PASSWORD=Pass@123
DB_NAME=mydb
DB_TYPE=mysqL
APP_NAME=My App
APP_URL=http://localhost:8000
HOST_PATH=/
ALLOWED_DOMAINS=["localhost:8000"]
#either 0 or 1 for ENABLE_SWAGGER DOCUMENTATION, If you set 0 it will not generate swagger documentation which will help you in production.
ENABLE_SWAGGER=0
# if you want to see stacktrace, you can set this value to 1 , Keep this 0 for production.
SHOW_STACKTRACE_IN_EXCEPTION=0
LOG_DIR=logs

HOST_PATH is the path name where you are going to deploy your application. 

For example: we have created a todo_app and we have deployed the application in our hostinger path. 

public_html/apps/todo_app

So the HOST_PATH will be /apps/todo_app

If you want to use the properties in your application, we have created one utility class Environment. 

You can call Environment::get('propertyName'); 

For further queries ask here.

by (570 points)
0 0
I hope this is very helpful for you.
Welcome to TrishulAPI Q&A, where you can ask questions and receive answers from other members of the community.
...