PHP code example of jameswmcnab / config-yaml
1. Go to this page and download the library: Download jameswmcnab/config-yaml 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/ */
jameswmcnab / config-yaml example snippets
bash
$ php artisan vendor:publish --provider=ConfigYamlServiceProvider
php
ConfigYaml::get('config.database.adapter'); // mysql
php
namespace App\Foo;
use Jameswmcnab\ConfigYaml\RepositoryInterface;
class FooBar
{
/**
* @var RepositoryInterface
*/
private $yamlConfig;
/**
* FooBar constructor.
*
* @param RepositoryInterface $yamlConfig
*/
public function __construct(RepositoryInterface $yamlConfig)
{
$this->yamlConfig = $yamlConfig;
}
/**
* @return array|string
*/
private function getDatabaseAdapter()
{
return $this->yamlConfig->get('config.database.adapter'); // mysql
}
}