rpodwika / yaml-config-service-provider
Based on deralex/YamlConfigServiceProvider YAML service provider for silex ~2.0 and symfony/yaml 3.~
Installs: 29 905
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- silex/silex: ^2.0
- symfony/yaml: ^3.1
This package is auto-updated.
Last update: 2024-10-23 10:24:08 UTC
README
Usage
<?php
require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application();
$app->register(new Rpodwika\Silex\YamlConfigServiceProvider(PATH_TO_CONFIG_FILE));
echo $app['config']['database']['driver'];
...
where PATH_TO_CONFIG_FILE
is location of YML file with configuration for example __DIR__ . "/../app/config/parameters.yml"
considering following directory structure:
- app
- config
- parameters.yml
- config
- web
- index.php
parameters.yml
database:
driver : 'pdo_mysql'
dbhost : 'localhost'
dbname : 'mydbname'
user : 'root'
password : ''
Installation
Add to composer.json
"require": {
"rpodwika/yaml-config-service-provider": "dev-master"
}
or run command composer require rpodwika/yaml-config-service-provider
This bundle is inspired on deralex/YamlConfigServiceProvider