I want to create a file .env:
FACEBOOK_CLIENT_ID=*****
FACEBOOK_CLIENT_SECRET=*****
and use variable for config
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'clientId' => env('FACEBOOK_CLIENT_ID'),
'clientSecret' => env('FACEBOOK_CLIENT_SECRET'),
],
You may define YII_ENV as one of the following values: prod: production environment. The constant YII_ENV_PROD will evaluate as true . This is the default value of YII_ENV if you do not define it. dev: development environment. The constant YII_ENV_DEV will evaluate as true.
This option is below the "System Protection" option. Click on Environment Variables. After clicking, it will show a new window dialog called "Environment Variables". Decide which variable to add (User / System). Click the New option in any (User/System) section.
Configurations are widely used in Yii when creating new objects or initializing existing objects. Configurations usually include the class name of the object being created, and a list of initial values that should be assigned to the object's properties.
Environment variables are used when you need a setting loaded into your application and you did not want it hardcoded directly into your application, it makes sense and is a normal way to think. You normally keep database connection, API settings like basic-auth or bear-token, but you can keep other data in environment variables.
I have found the solution.
I use package vlucas/phpdotenv.
Thank for all
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