Welcome to Trishul API Questions and Answers. Help and learn how to use it efficiently.
0 like 0 dislike
10 views
ago in App by (270 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
ago by (270 points)

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=todos
DB_TYPE=mysql
These properties are used for swagger documentation 
APP_NAME=Todos
APP_URL=http://localhost:8080
HOSTED_PATH=/
HOSTED_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 HOSTED_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.
ago by (270 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.
...