Questions tagged [phpdotenv]

PHP dotenv is a PHP library that loads environment variables from a text file named .env for easy access from PHP code. This library is based on the Ruby gem (see [ruby-dotenv] tag.) There is also a Node.js module (see [dotenv] tag.)

Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically.

Code repository: https://github.com/vlucas/phpdotenv

Packagist page: https://packagist.org/packages/vlucas/phpdotenv

83 questions
0
votes
1 answer

How to read environment variables in travis-ci for Lumen application

I have a Lumen application that is using the Dotenv library from vlucas. When trying to deploy, travis-ci complains that there is no ".env" file. Do I need to modify my bootstrap/app.php file to conditionally load the Dotenv class, or is there a…
Brian Anderson
  • 621
  • 7
  • 22
0
votes
1 answer

Ignore .env file on unit tests

Most of my classes include loading env variables for configuration. When I was coding I thought vlucas/phpdotenv ignored the .env file on testing environments since there is already a conf file like phpunit.xml where you define them. Is it possible…
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206
-1
votes
1 answer

how to properly load libraries in php?

I'm working with two libraries: phpdotenv spatie/async This is what I'm executing:
Dexter Naru
  • 213
  • 2
  • 5
  • 17
-1
votes
1 answer

Heroku Symfony app Unable to read the "/tmp/build_2f06b5cf/.env" environment file

After updating composer to v1 to v2, my build on heroku is failing, error message : Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 255 !! PHP Fatal error: Uncaught…
Dezz H
  • 322
  • 6
  • 23
-1
votes
1 answer

How to limit a package's dependency to a certain PHP version in Composer?

Our production server is PHP 5.5.24. A package I need (vlucas/dotenv) requires in its composer.json: "symfony/polyfill-ctype": "^1.17" Unfortunately version 1.20 of that symfony package requires 7.1, which causes Composer's platform check to fail.…
Vael Victus
  • 3,966
  • 7
  • 34
  • 55
-1
votes
2 answers

Symfony 5.3 Mailer setup env vars not reading correctly

In a Symfony 5.3 project I am using the Mailer (..\Symfony\Component\Mailer\MailerInterface) to send mails. For devolopment I required "symfony/google-mailer" with composer and set it up in .env.local. Say username is "example@gmail.com" and…
user3440145
  • 793
  • 10
  • 34
-1
votes
1 answer

Symfony 5.1.8 ignoring overrides from .env.test / .env.test.local

I have a Symfony 5.1.8 project, in which I want to use a different database connection for testing. To do so, I set up the file .env.test.local with a different value for DATABASE_URL than in my .env.local, just like the documentation in the .env…
dende
  • 119
  • 2
  • 8
-1
votes
1 answer

Path issue with PHP Dotenv

Im new to this, and have been trying for a few hours to get this to work. I have a project with this structure: /API -.env /Processor -index.php The contents of my .env file is this: API_KEY=xxxx and in my index.php file require…
Dirty Bird Design
  • 5,333
  • 13
  • 64
  • 121
1 2 3 4 5
6