Home / Snippets / How to Comment Configuration in Laravel .env File (Environment)?
How to Comment Configuration in Laravel .env File (Environment)? cover

How to Comment Configuration in Laravel .env File (Environment)?

1.3K

3 years ago

0 comments

To comment configuration inside the .env file you can make use of the "#" hashtags character. Since Laravel is using the vlucas/phpdotenv package to parse .env file, based on the documentation it's using the "#" character.
# This is a comment
VAR="value here" # comment here is ignroed
VAR2=value # comment here is ignored
The config above will output the code below.
<?php

env('VAR'); // value here
env('VAR2'); // value
To add "#" as a value you need to wrap it with double-quote.
VAR_HERE="#hashtags"
The output will be as follows
<?php

env('VAR_HERE'); // #hashtags
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this