Skip to content

Instantly share code, notes, and snippets.

@Vigowebs
Created November 26, 2022 05:03
Show Gist options
  • Save Vigowebs/fcd88cbaeb0986702c8a2a0882e6c7e3 to your computer and use it in GitHub Desktop.
Save Vigowebs/fcd88cbaeb0986702c8a2a0882e6c7e3 to your computer and use it in GitHub Desktop.
Do not get data from the .env file directly. Pass the data to config files instead and then use the config() helper function to use the data in an application.
// ❌
$apiKey = env('API_KEY');
// ✔️
// config/api.php
'key' => env('API_KEY'),
// Use the data
$apiKey = config('api.key');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment