PHP code example of machaven / laravel-cascading-config

1. Go to this page and download the library: Download machaven/laravel-cascading-config library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

machaven / laravel-cascading-config example snippets

config/example.php
config/local/example.php



return [
    'clientApi' => [
        'baseUrl' => env('CLIENT_API_BASE_URL', 'http://test.local/api/'),
    ],
    'test' => env('TEST', 'local'),
];

>>> config('example');
=> [
     "clientApi" => [
       "curlTimeout" => 5, // This is merged from the config/example.php config file
       "baseUrl" => "http://test.local/api/",
       "username" => "username in .env file",
       "password" => "password in .env file",
     ],
     "test" => "local",
   ]