Laravel Add Custom Configuration File Example
Now, let's see article of laravel add custom configuration file. This article will give you simple example of laravel custom config file. we will help you to give example of laravel custom configuration file. you can see how to create custom config file in laravel. Let's get started with create your own config file laravel.
you can easily create custom configuration file in laravel 6, laravel 7 and laravel 8 version.
in this example, we will create google.php config file and set api key on there. then we will simply get value using config() helper. let's see example.
now first add your new variable on env file as like bellow:
'api_token' => env('GOOGLE_API_TOKEN', 'your-some-default-value'),
$googleAPIToken = config('google.api_token');
now you can check your own.
i hope it can help you...
We are Recommending you
- How to use Laravel Model Observers?
- Laravel 8 Clear Cache of Route, View, Config Command Example
- How to Use Environment Variable in Angular?
- Laravel Deployment on Cloudways with Envoyer
- How to Set Config File Value in Laravel?
- How to Get Config File Value in Laravel?
- How to set git config username and email?
- Laravel clear cache from route, view, config and all cache data from application
- How to set gmail configration for mail in Laravel?