How To Create Custom Config File In Laravel

Config folder contains one of the important files in laravel.it contains main setting for your laravel application for example database connection , Api keys ,queue etc.
config returns an array .to access an array we need to use config key with file name
and descendant key separate by dot(.)

For example if you have config file as

//config/socialname.php
<?php

return [

‘social’ =>

[

‘facebook_username’ => ‘john doe’ ,

‘instagram_user_name’

]

];

?>

To access this array of socialname.php file from config directory
you have to use config keyword

dd(config(‘socialname.social.facebook_username’));

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Azen Moktan

A highly resourceful, innovative, and competent Software Engineer with extensive experience in the design , coding and problem solving .