Application setting contained in application.php file can be read using two methods
getSetting of Nishchay facade class.
getConfig is for reading only application setting while
getSetting we can read any setting. Method
getSetting method requires config path to be prefixed by its file name.
application.name setting using
Reading other setting
Settings other than
application.php are read by using
getSetting method. We can read any setting contained in
Let's take an example that we have setting file called:
credentials.php. This setting contains following configuration:
return [ 'github' => [ 'apiUrl' => 'https://api.github.com/', 'apiKey' => 'GITHUB_API_KEY' ] ];
apiKey from above setting:
We can also read setting which have array of values.
$github = Nishchay::getSetting('credentials.github');
Above will return both
apiKey as object. As we have stored github config in
$github variable, its setting can be read as follows:
Other setting methods
There are various methods in Nishchay class which allows us to directly check for application stage name or if application is live or not and etc. Such methods are listed below
|getApplicationAuthor||Application author name|
|getApplicationStage||Current application stage|
|getApplicationVersion||Current application version|
|getSupportedExtension||Returns supported file extensions as array|
Notes are visible to you only and its for your use only. Its good to note a point of what you read.