PHP code example of opxcore / config-repository-files
1. Go to this page and download the library: Download opxcore/config-repository-files 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/ */
opxcore / config-repository-files example snippets
use OpxCore\Config\ConfigRepositoryFiles;
$configFiles = new ConfigRepositoryFiles($path);
use OpxCore\Interfaces\ConfigRepositoryInterface;
use OpxCore\Config\ConfigRepositoryFiles;
$container->bind(
ConfigRepositoryInterface::class,
ConfigRepositoryFiles::class,
['path' => $path]
);
$configFiles = $container->make(ConfigRepositoryInterface::class);
// or
$container->bind(ConfigRepositoryInterface::class, ConfigRepositoryFiles::class);
$configFiles = $container->make(ConfigRepositoryInterface::class, ['path' => $path]);
// app.php
return [
'name' => 'My awesome application',
'enabled' => env('ENABLED', true),
// and so on
];
\OpxCore\Config\ConfigEnvironment::load();
$configFiles = new ConfigRepositoryFiles('/myapp/config');
// loads config files from /myapp/config
$configFiles->load($config);
// loads config files from /myapp/config/default
$configFiles->load($config, 'default');
// loads config files from /myapp/config/web and merges result
// with /myapp/config/default. 'web' has higher priority.
$configFiles->load($config, 'web', 'default');