Slim 4 Authentication (Lesson 7: Env Variables Files)

preview_player
Показать описание
#Slim4Authentication #DotenvSlim4 #Slim4Authentication

Lesson 7: Env Variables Files (Slim 4 Authentication)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In todays Slim 4 Authentication tutorial we're going to setup the ability to load variables into our Environment via a .env file that his hidden from our version control.

This is a very important step when it comes to security. Hiding our environment variables from versions control allows us to dynamically create a .env variable where need to defined security credentials, such as production database credentials, that not ever dev should have access to.

While not everyone is allowed to access Production Environment settings, everyone does need the option to set environment variables so each developer can work on the codebase locally.



Github Repository
~~~~~~~~~~~~
Рекомендации по теме
Комментарии
Автор

Hi! Just noticed that some of the helperfunctions that you define are already included in the Illuminate/support package, For example the env() function defined in this video is never used. Atleast this is the case in my environment.

gregervondassendorf
Автор

for "vlucas/phpdotenv": "^5.0" -> no longer available
$env = Dotenv::createImmutable (base_path()); but $env = Dotenv::createUnsafeImmutable (base_path());

wwe
Автор

Hi CCS! I'd add Dotenv to the require-dev section of composer.json. If it's not installed, the exception thrown when instanciating it gets caught and debugging usually isn't done on the production box. But the documentation on Github and every example / tutorial I've seen so far is adding it to the normal require section. I see no reason to do that.

chrishuhn