PHPackages                             ap-lib/conf - 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. ap-lib/conf

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

ap-lib/conf
===========

015PHP

Since Mar 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ap-lib/conf)[ Packagist](https://packagist.org/packages/ap-lib/conf)[ RSS](/packages/ap-lib-conf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AP\\Conf
========

[](#apconf)

[![MIT License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

AP\\Conf is a library for managing project configuration variables, featuring validation and object transformation capabilities.

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

[](#installation)

```
composer require ap-lib/conf
```

Features
--------

[](#features)

- Retrieve environment variables and PHP configuration files as objects with validation.
- Built-in validation mechanisms with error handling.

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

Getting started
---------------

[](#getting-started)

### Lazy Loading with `MyConf`

[](#lazy-loading-with-myconf)

You can create a custom configuration loader using a static class that extends `Conf`

```
use AP\Conf\Conf;
use AP\Scheme\ToObject;
use AP\Scheme\Validation;

readonly class SecuritySettings implements ToObject, Validation {
    public function __construct() {
        public string $salt
    }
}

class MyConf extends Conf
{
    public static function security(): SecuritySettings
    {
        return self::obj(__FUNCTION__, SecuritySettings::class);
    }
}

class Core
{
    static public function conf(): MyConf
    {
        return new MyConf(
            [
                __DIR__ . "/../conf",
                __DIR__ . "/../conf/local",
            ]
        );
    }
}

$salt = Core::conf()->security()->salt;
```

### Configuration Loading Behavior

[](#configuration-loading-behavior)

1. The library first checks the `$_SERVER['security']` variable first, expecting a JSON string.
2. If not found in the environment variables, it merges values from the following files if they exist:
    - `__DIR__/../conf/security.php`
    - `__DIR__/../conf/local/security.php`
3. Values from the next file, such as `conf/local/security.php`, take priority and override those from the previous file, such as `conf/security.php`.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1215fe5ecc9ba0ab1c730d3c992125cf6ebf460562e66be71ebae127789d465a?d=identicon)[AntonPanfilov](/maintainers/AntonPanfilov)

---

Top Contributors

[![anton-panfilov](https://avatars.githubusercontent.com/u/1083546?v=4)](https://github.com/anton-panfilov "anton-panfilov (2 commits)")

### Embed Badge

![Health badge](/badges/ap-lib-conf/health.svg)

```
[![Health](https://phpackages.com/badges/ap-lib-conf/health.svg)](https://phpackages.com/packages/ap-lib-conf)
```

PHPackages © 2026

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