All laravel configuration files are found inside the config
directory and all of them are returned as an associative array
//for example Session.php
return[
/******************************
* session name
******************************/
"name" => "newBlog"
];
Later on this configuration can be used like this
Config::get("session.name");
How does this method get
works ?? is it using require
to require all these files ??? i tried to find the file of the config class but i didn't get the logic
Illuminate\Support\Facades\Config
i cant find the get method
so please how is this implemented ??? what's the logic behind?
We use the config() method to get values from files in the config directory. We use the dot notation to get the value we want. The first parameter we use is the file's name without the . php extension.
Laravel's filesystem configuration file is located at config/filesystems.php . Within this file, you may configure all of your filesystem "disks". Each disk represents a particular storage driver and storage location.
All of the configuration files for the Laravel framework are stored in the app/config directory. Each option in every file is documented, so feel free to look through the files and get familiar with the options available to you.
Laravel configuration allows you to define per-environment configuration with the excellent vlucas/phpdotenv package. If you are new to Laravel, you might not yet know how you can create your configuration files in your projects and a few other helpful things that will help you master configuration.
It is in Illuminate\Config\Repository
public function get($key, $default = null)
{
return Arr::get($this->items, $key, $default);
}
Further, instead of Config facade, you can use config helper as config('session.name')
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