vlucas / phpdotenv

Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
BSD 3-Clause "New" or "Revised" License
13.11k stars 624 forks source link

Please dont use $_SERVER #556

Closed felloz closed 1 year ago

felloz commented 1 year ago

Is there a way to not override PHP's super global constant $_SERVER with the contents of the library?

GrahamCampbell commented 1 year ago

Yes. phpdotenv is very modular and flexible using composition. You can use the repository builder class without the default adapters, and then call create directly: https://github.com/vlucas/phpdotenv/blob/master/src/Dotenv.php#L83.