The environment file is invalid!Failed to parse dotenv file. Encountered an invalid name at {your env code}

Posted by

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Problem:- When i run Composer install command in my laravel project to upgrade my project version after adding all the dependencies i got this env error
Error:

The environment file is invalid!
Failed to parse dotenv file. Encountered an invalid name at [GET-ALL-QUOTE-BY-FIRM].

Below is my env file

The Solution is:

The problem most likely stems from the rule that special characters and spaces shouldn’t be used in variable names in.env files. In most configuration systems, variable names like GET-ALL-QUOTE-BY-FIRM and others with similar formats are invalid.

You should change the names to adhere to the accepted variable naming guidelines in order to fix this problem. Variable names should normally only contain underscores, numerals, and capital letters. For instance, you can use underscores in place of hyphens:

GET_ALL_QUOTE_BY_FIRM=/api/v1/j/get-all-quote-by-firm
GET_QUOTE_BY_FIRM_ID=/api/v1/j/get-quote-by-firm-id
GET_ALL_BID_BY_FIRM=/api/v1/j/get-all-bid-by-firm
CREATE_BID_BY_FIRM=/api/v1/j/create-bid-by-firm

By Doing these steps you have to run composer install command:

composer install

Now you error will be solved and your laravel project will run.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x