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

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.

Senior Software Development Engineer at Cotocus

Related Posts

How We Fixed a Stubborn Laravel MeiliSearch Bulk Indexing Failure (16,000+ Records)

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 If…

Read More

Laravel Search Without Docker, Queues, or Horizon

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 Modern…

Read More

Laravel Scout with Typesense vs Meilisearch

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 Modern…

Read More

SESSION_DRIVER=file vs SESSION_DRIVER=database in Laravel

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 Which…

Read More

Laravel Logging: Complete Step-by-Step Guide to Enable, Debug, Verify, and Master Logs in Any Laravel Project

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 Logging…

Read More

Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)

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 This…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments