PHPackages                             df/silex-yaml-config-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. df/silex-yaml-config-provider

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

df/silex-yaml-config-provider
=============================

Just another Silex ServiceProvider for using YAML configuration files

0.9.2(9y ago)43.4kMITPHP

Since Apr 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/dunkelfrosch/silex-yaml-config-provider)[ Packagist](https://packagist.org/packages/df/silex-yaml-config-provider)[ RSS](/packages/df-silex-yaml-config-provider/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (3)Used By (0)

YamlConfigServiceProvider
=========================

[](#yamlconfigserviceprovider)

Service provider for Silex for using YAML configuration files. This provider based on a fork of Alexander Kluth  yaml-config service provider available on [Github](https://github.com/deralex/YamlConfigServiceProvider) including minor improvements and changes to run up the latest version of php(7).

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Build Status](https://camo.githubusercontent.com/6610323426262fdb7f6ff3fee0ff7d86e164e44d37a51e5dfbe1df7109744813/68747470733a2f2f7472617669732d63692e6f72672f64756e6b656c66726f7363682f73696c65782d79616d6c2d636f6e6669672d70726f76696465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dunkelfrosch/silex-yaml-config-provider)

Installation
------------

[](#installation)

To use it add following line to your composer.json:

```
"require": {
    ...
    "df/silex-yaml-config-provider": "dev-master"
    ...
}

```

Usage
-----

[](#usage)

Include following line of code somewhere in your initial Silex file (index.php or whatever):

```
$app->register(new DF\Silex\Provider\YamlConfigServiceProvider(PATH_TO_CONFIG));

```

Now you have access to all of your configuration variables through `$app['config']`.

Example
-------

[](#example)

config.yml:

```
database:
    host: localhost
    user: myuser
    password: mypassword

```

index.php:

```
