I'd like to add a string value to my .env
file that contains quotes like so.
APP_NAME="Hacking"
Laravel assumes the quotes are being used to define the string, but I want the literal quote in the string.
I've also tried the following.
APP_NAME='"Hacking"'
APP_NAME=\"Hacking\"
APP_NAME="\"Hacking\""
Try this:
APP_NAME='""Hacking""'
or this:
APP_NAME="\"\"Hacking\"\""
The dotenv library removes the outer layer of single or double quotes when it sets the environment variable: https://github.com/vlucas/phpdotenv/blob/fa1a24d/src/Loader.php#L249
Laravel's env()
helper removes the outer layer of double quotes when it retrieves the variable:
https://github.com/laravel/framework/blob/2ab2fc6/src/Illuminate/Support/helpers.php#L613
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With