PHPackages                             laruence/yaconf - 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. laruence/yaconf

ActivePhp-ext

laruence/yaconf
===============

A PHP Persistent Configurations Container

1.0k0178[2 issues](https://github.com/laruence/yaconf/issues)[1 PRs](https://github.com/laruence/yaconf/pulls)CCI passing

Since Aug 1Pushed today76 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Yaconf - Yet Another Configuration Container
============================================

[](#yaconf---yet-another-configuration-container)

[![Build status](https://camo.githubusercontent.com/2c0aeee34bc45847ca9d0a14c60ad2229db03f469944cb9dfd6d60c8ce8327ac/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6862726d6368366e70383534623462352f6272616e63682f6d61737465723f7376673d74727565)](https://ci.appveyor.com/project/laruence/yaconf/branch/master) [![Build Status](https://github.com/laruence/yaconf/workflows/integrate/badge.svg)](https://github.com/laruence/yaconf/actions?query=workflow%3Aintegrate)

A PHP Persistent Configuration Container

Requirement
-----------

[](#requirement)

- PHP 7+

Introduction
------------

[](#introduction)

Yaconf is a configuration container. It parses INI files and stores the result in PHP at startup. Configurations live for the entire PHP lifecycle, which makes it very fast.

Features
--------

[](#features)

- Fast, light
- Zero-copy when accessing configurations
- Supports sections and section inheritance
- Configurations reload automatically after changes

Install
-------

[](#install)

### Install via PECL

[](#install-via-pecl)

Yaconf is a PECL extension, simply install it by:

```
$ pecl install yaconf
```

### Compile from source

[](#compile-from-source)

```
$ /path/to/phpize
$ ./configure --with-php-config=/path/to/php-config
$ make && make install
```

Runtime Configuration
---------------------

[](#runtime-configuration)

INI SettingDefaultDescription`yaconf.directory`*(none)*Path to the directory where all INI configuration files are placed`yaconf.check_delay``300`Interval in seconds at which Yaconf checks for config file changes (by the directory's mtime). Set to `0` to disable automatic reloading — you will need to restart PHP to reload configurations.Constants
---------

[](#constants)

```
YACONF_VERSION
```

APIs
----

[](#apis)

### Yaconf::get

[](#yaconfget)

```
mixed Yaconf::get(string $name, mixed $default = null)
```

Fetches a configuration value by its `$name`. The `$name` uses dot notation to traverse nested keys (e.g. `"foo.name"`, `"foo.features.1"`, `"foo.features.plus"`).

Returns the configuration value on success, or `$default` (which defaults to `null`) if the key is not found.

### Yaconf::has

[](#yaconfhas)

```
bool Yaconf::has(string $name)
```

Returns `true` if a configuration value exists at `$name`, `false` otherwise.

```
