PHPackages                             lovelock/yafconf - 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. lovelock/yafconf

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

lovelock/yafconf
================

1.5(9y ago)2221MITPHP

Since Aug 6Pushed 9y agoCompare

[ Source](https://github.com/lovelock/yafconf)[ Packagist](https://packagist.org/packages/lovelock/yafconf)[ RSS](/packages/lovelock-yafconf/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (5)Used By (0)

A config wrapper for Yaf
========================

[](#a-config-wrapper-for-yaf)

**Notice**This is designed for Yaf, if you're using other framework, leave it.

Feautures
---------

[](#feautures)

1. Global environment setting support.
2. Simple API.

Usage
-----

[](#usage)

### 1. Using composer

[](#1-using-composer)

#### 1. Add a method in `Bootstrap`

[](#1-add-a-method-in-bootstrap)

```
class Bootstrap extends Yaf\Bootstrap_Abstract
{

    public function _initLoader(Dispatcher $dispatcher)
    {
        require __DIR__ . '/../vendor/autoload.php';
    }
}
```

#### 2. Download it via composer

[](#2-download-it-via-composer)

`composer require lovelock/yafconf`

### 2. Classic way

[](#2-classic-way)

If you don't like composer, you can require it from your local directory as well. You may put it in your library path as you wish.

Pre-configuration
-----------------

[](#pre-configuration)

This project relies on two global constants

1. `CONF_PATH`This tells Conf where to find the .ini files.
2. `APP_ENV`This tells Conf what directives to find in .ini files.

### Api

[](#api)

#### 1. `Conf::get($key)`

[](#1-confgetkey)

`$key` **MUST** be `.` seperated. I.E, a dot is used as a seperator of the configuration path and its real key. e.g:

```
Conf::get('database.database.host')
```

will find the `database.ini` in `CONF_PATH` and fetch the value of the key `database.host` in the configuration.

It supports array as well, which means, if your configuration file is like this:

```
; database.ini
[product]
database.dbtype=mysql
database.host=127.0.0.1
database.port=3306
database.dbname=ttlive
database.user=root
database.password=root
database.charset=utf8

[dev : product]
database.host=192.168.1.103
```

`Conf::get('database.database')` will give you an array

```
array (
    'dbtype'   => 'mysql',
    'host'     => '127.0.0.1',
    'port'     => '3306',
    'dbname'   => 'ttlive',
    'user'     => 'root',
    'password' => 'root',
    'charset'  => 'utf8',
)

```

Further more, if you set the constant `APP_ENV = dev`, and the result array would be

```
array (
    'dbtype'   => 'mysql',
    'host'     => '192.168.1.103',
    'port'     => '3306',
    'dbname'   => 'ttlive',
    'user'     => 'root',
    'password' => 'root',
    'charset'  => 'utf8',
)

```

TODO
----

[](#todo)

1. Add default value support.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

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 ~1 days

Total

4

Last Release

3613d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2208731?v=4)[Frost Wong](/maintainers/lovelock)[@lovelock](https://github.com/lovelock)

---

Top Contributors

[![lovelock](https://avatars.githubusercontent.com/u/2208731?v=4)](https://github.com/lovelock "lovelock (17 commits)")

### Embed Badge

![Health badge](/badges/lovelock-yafconf/health.svg)

```
[![Health](https://phpackages.com/badges/lovelock-yafconf/health.svg)](https://phpackages.com/packages/lovelock-yafconf)
```

PHPackages © 2026

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