PHPackages                             opxcore/config - 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. opxcore/config

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

opxcore/config
==============

The OpxCore config.

1.0.1(5y ago)131MITPHPPHP ^7.4CI failing

Since Jan 13Pushed 5y agoCompare

[ Source](https://github.com/opxcore/config)[ Packagist](https://packagist.org/packages/opxcore/config)[ Docs](https://opxcore.com)[ RSS](/packages/opxcore-config/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

[![Build Status](https://camo.githubusercontent.com/469b1560df6fdce9b5a7c4041f95ece16275c9109a5f38821423aee847ff967d/68747470733a2f2f7472617669732d63692e636f6d2f6f7078636f72652f636f6e6669672e7376673f6272616e63683d6d61696e)](https://travis-ci.com/opxcore/config)[![Coverage Status](https://camo.githubusercontent.com/ffaed3706f888d582f168c4ad96a00db6ce14a1089ab1d9957df282c79555ad3/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f7078636f72652f636f6e6669672f62616467652e737667)](https://coveralls.io/github/opxcore/config)[![Latest Stable Version](https://camo.githubusercontent.com/bbda8024545ded8d4b8cc64f5a5759c49ff1813a774336af9d0ede30e9eae699/68747470733a2f2f706f7365722e707567782e6f72672f6f7078636f72652f636f6e6669672f762f737461626c65)](https://packagist.org/packages/opxcore/config)[![Total Downloads](https://camo.githubusercontent.com/8f1d37f4331d416b2e12215868a59e9d77a0a54963e07dcb44abe6704c8946b7/68747470733a2f2f706f7365722e707567782e6f72672f6f7078636f72652f636f6e6669672f646f776e6c6f616473)](https://packagist.org/packages/opxcore/config)[![License](https://camo.githubusercontent.com/38996114f89863e68c670f62411b4f7a14f944f5ea98c086243b02fec65ecb43/68747470733a2f2f706f7365722e707567782e6f72672f6f7078636f72652f636f6e6669672f6c6963656e7365)](https://packagist.org/packages/opxcore/config)

Config
======

[](#config)

Config is a component designed to load config for your project. It uses three components as dependency injection: config repository loader, config caching and environment variables. All of them set to config as dependency injection. In general, you can use standard components operating on local files. Also, you can make your own components for your purposes. Each of they must implement teh corresponding interface (see below).

Of course, these three components are optional. If component is not set, functionality it provides would not be able.

Creating
--------

[](#creating)

```
$config = new \OpxCore\Config\Config($repository, $cache, $environment);
```

### Config repository

[](#config-repository)

Config repository provides functionality for loading configuration. This component must implement [ConfigRepositoryInterface](https://github.com/opxcore/config-repository-interface).

Realization: [ConfigRepositoryFiles](https://github.com/opxcore/config-repository-files)

### Config cache

[](#config-cache)

This component provides functionality for configuration caching. This component must implement [ConfigCacheInterface](https://github.com/opxcore/config-cache-interface).

Realization: [ConfigCacheFiles](https://github.com/opxcore/config-cache-files)

### Environment

[](#environment)

This component provides functionality for defining configuration values via environment files. This component must implement [EnvironmentInterface](https://github.com/opxcore/config-environment-interface).

Realization: [Environment](https://github.com/opxcore/config-environment)

In case of environment is assigned to config, last one can use environment variables to configure cache driver.

```
# Is config caching disabled. true of false
CONFIG_CACHE_ENABLE=true
# Cache lifetime in seconds. null for forever
CONFIG_CACHE_TTL=null
```

Loading configuration
---------------------

[](#loading-configuration)

```
$config->load($profile, $overrides, $force);
```

`$profile` and `$overrides` are variables passed to config repository ( see [repository](https://github.com/opxcore/config-repository-files)) for more information.

If `$forse` is set to `true`, loading configuration from cache will bi skipped, as cached configuration was not found.

Accessing configuration
-----------------------

[](#accessing-configuration)

Config implements `ArrayAccess` interface, so you can use `$config` as an array.

Accessing to configuration is realized with [Array](https://github.com/opxcore/array) so all operations with keys uses dot notation.

`$config->has($key);` same as `isset($config[$key]);` checks if value is defined;

`$config->get($key, $default);` same sa `$config[$key];` gets value;

`$config->set($key, $value);` same as `$config[$key] = $value;` sets value;

`$config->push($key, $value);` pushes value;

`$config->all();` returns all configuration array.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 79.2% 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 ~153 days

Recently: every ~191 days

Total

6

Last Release

1958d ago

Major Versions

0.2.3 → 1.0.02021-02-03

PHP version history (2 changes)0.2PHP ^7.1.3

1.0.0PHP ^7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46634185?v=4)[opxcore](/maintainers/opxcore)[@opxcore](https://github.com/opxcore)

---

Top Contributors

[![lozovoyv](https://avatars.githubusercontent.com/u/21274927?v=4)](https://github.com/lozovoyv "lozovoyv (19 commits)")[![opxcore](https://avatars.githubusercontent.com/u/46634185?v=4)](https://github.com/opxcore "opxcore (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opxcore-config/health.svg)

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

PHPackages © 2026

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