Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get All ENV variables in Laravel

Laravel has a .env file that contains various variables. Is there a way to get all the variables in one line of PHP code? I don't want to write

echo env('APP_DEBUG')
echo env('APP_URL')
etc...

I have tried

env("*")
env("*")

but none works.

like image 500
James Arnold Avatar asked Dec 04 '22 18:12

James Arnold


1 Answers

This should work:

$_ENV; // gives all env variables.


To get a single env variable:

$_ENV['VARIABLE'];
like image 62
Zeshan Avatar answered Dec 11 '22 15:12

Zeshan