0
0
Laravelframework~10 mins

Environment configuration in Laravel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load environment variables in Laravel.

Laravel
Dotenv::createImmutable(__DIR__)->[1]();
Drag options to blanks, or click blank then click option'
Ainit
Brun
Cload
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods like run or start which do not exist in Dotenv.
Confusing initialization with loading.
2fill in blank
medium

Complete the code to get the value of APP_ENV from environment variables.

Laravel
$environment = env('[1]', 'production');
Drag options to blanks, or click blank then click option'
AAPP_ENV
BAPP_DEBUG
CAPP_URL
DAPP_NAME
Attempts:
3 left
💡 Hint
Common Mistakes
Using APP_DEBUG which controls debug mode, not environment.
Using APP_URL or APP_NAME which are unrelated.
3fill in blank
hard

Fix the error in the code to correctly set the database host from environment variables.

Laravel
'host' => env('[1]', '127.0.0.1'),
Drag options to blanks, or click blank then click option'
ADB_HOST
BDB_DATABASE
CDB_PORT
DDB_USERNAME
Attempts:
3 left
💡 Hint
Common Mistakes
Using DB_PORT which is for the port number.
Using DB_DATABASE which is the database name.
Using DB_USERNAME which is the user name.
4fill in blank
hard

Fill both blanks to set the mail driver and mail host from environment variables.

Laravel
'driver' => env('[1]', 'smtp'),
'host' => env('[2]', 'smtp.mailtrap.io'),
Drag options to blanks, or click blank then click option'
AMAIL_MAILER
BMAIL_DRIVER
CMAIL_HOST
DMAIL_PORT
Attempts:
3 left
💡 Hint
Common Mistakes
Using MAIL_MAILER instead of MAIL_DRIVER in older Laravel versions.
Confusing MAIL_PORT with MAIL_HOST.
5fill in blank
hard

Fill all three blanks to set cache driver, queue connection, and session driver from environment variables.

Laravel
'cache' => env('[1]', 'file'),
'queue' => env('[2]', 'sync'),
'session' => env('[3]', 'file'),
Drag options to blanks, or click blank then click option'
ACACHE_DRIVER
BQUEUE_CONNECTION
CSESSION_DRIVER
DCACHE_CONNECTION
Attempts:
3 left
💡 Hint
Common Mistakes
Using CACHE_CONNECTION instead of CACHE_DRIVER.
Mixing up QUEUE_CONNECTION and SESSION_DRIVER.