PHPackages                             tabbi/config-service-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. tabbi/config-service-provider

ActiveLibrary

tabbi/config-service-provider
=============================

A config ServiceProvider for Silex with support for php, json and yaml.

v1.1.0(12y ago)0931[3 issues](https://github.com/tabbi89/ConfigServiceProvider/issues)MITPHP

Since Nov 24Pushed 12y ago1 watchersCompare

[ Source](https://github.com/tabbi89/ConfigServiceProvider)[ Packagist](https://packagist.org/packages/tabbi/config-service-provider)[ RSS](/packages/tabbi-config-service-provider/feed)WikiDiscussions master Synced today

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

ConfigServiceProvider
=====================

[](#configserviceprovider)

A config ServiceProvider for [Silex](http://silex.sensiolabs.org) with support for php, json, yaml, and toml. It is based on Igor Wiedler [ConfigServiceProvider](https://github.com/igorw/ConfigServiceProvider). The main diffrence is in usage. It allows now to get config options in "Laravel way". Getting config keys is very simple, first define a folder where you will store all your config files then add all the files into it. The first level of key is file name, next levels depends on you.

Example:

```
# config/database.php
return = array(
    'db_name' => 'test',
    'db_password' => 'password',
    'db_user' => 'user',
    'db_host' => 'localhost',
);

```

The getting key will be `database.db_name`.

Usage
-----

[](#usage)

### Using Yaml

[](#using-yaml)

To use Yaml just pass a file that ends on `.yml` or `.yaml` in add method:

```
$app->register(new Tabbi\Silex\ConfigServiceProvider());
$app['config']->add(__DIR__."/../config/services.yml");
echo $app['config']->get('services.option.value');

```

Note, it requires `~2.3` - `symfony/yaml` package.

### Using TOML

[](#using-toml)

To use [TOML](https://github.com/mojombo/toml) instead of any of the other supported formats, just pass a file that ends on `.toml`:

```
$app->register(new Tabbi\Silex\ConfigServiceProvider());
$app['config']->add(__DIR__."/../config/services.toml");
echo $app['config']->get('services.option.value');

```

Note, it requires `~0.1` - `jamesmoss/toml` package and you are using a bleeding edge configuration format, as the spec of TOML is still subject to change.

### Using plain PHP

[](#using-plain-php)

Use simple php configs that returns the array of config data, and also make sure it ends with `.php`:

```
$app->register(new Tabbi\Silex\ConfigServiceProvider());
$app['config']->add(__DIR__."/../config/services.php");
echo $app['config']->get('services.option.value');

```

### Using Json

[](#using-json)

To use Json just pass a file that ends on `.json` in add method:

```
$app->register(new Tabbi\Silex\ConfigServiceProvider());
$app['config']->add(__DIR__."/../config/services.json");
echo $app['config']->get('services.option.value');

```

### Multiple config files

[](#multiple-config-files)

You can use multiple config files, e. g. one for a whole application and a specific one for a task by calling `$app['config]->add()` several times.

```
$app->register(new Tabbi\Silex\ConfigServiceProvider());
$app['config']->add(__DIR__."/../config/services.php");
$app['config']->add(__DIR__."/../config/database.php");
$app['config']->add(__DIR__."/../config/cache.php");
echo $app['config']->get('services.option.value');
echo $app['config']->get('database.option.value');
echo $app['config']->get('cache.option.value');

```

### Register order

[](#register-order)

Make sure you do not register anything with `config` name. You don't have to keep correct order just remember to add config before its usage.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Total

2

Last Release

4538d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/00b23dedb4e4d74d895843cb2c71ee5f35acebbb2a6c61f6082b4ecdcccdb762?d=identicon)[tabbi89](/maintainers/tabbi89)

---

Top Contributors

[![tabbi89](https://avatars.githubusercontent.com/u/5837714?v=4)](https://github.com/tabbi89 "tabbi89 (8 commits)")

---

Tags

silex

### Embed Badge

![Health badge](/badges/tabbi-config-service-provider/health.svg)

```
[![Health](https://phpackages.com/badges/tabbi-config-service-provider/health.svg)](https://phpackages.com/packages/tabbi-config-service-provider)
```

###  Alternatives

[moriony/silex-mongo-provider

Mongo service provider for the Silex framwork.

118.5k](/packages/moriony-silex-mongo-provider)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
