How to get .env variable in blade or controller

In a blade template, you can access the environment variables using the env() helper function. For example, if you have an environment variable named APP_NAME, you can access it in your blade template like this:

{{ env(‘APP_NAME’) }}

In a controller, you can access the environment variables using the env() helper function. For example, if you have an environment variable named APP_NAME, you can access it in your controller like this:

$appName = env(‘APP_NAME’);


How to get .env variable in blade or controller

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?