'Laravel - Can't get .pem public key data from .env file

I have an webapp built with Laravel and i need to use a public key from a .pem file to verify some data. The key is kept in the .env file and retrieved via config/app.php with the env() helper. Since the .pem key needs to be on separate lines with specific length i use \n characters to keep the key on one line. Problem is that when i use the \n characters the variable is not cached and i cannot access it. When i remove the \n characters i can retrieve the variable but the openssl_get_privatekey($key); returns false. What am i doing wrong? Is this a Laravel or some general PHP issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source