PHPackages                             opencoreemr/oce-lib-module-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. opencoreemr/oce-lib-module-config

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

opencoreemr/oce-lib-module-config
=================================

Shared configuration accessor library for OpenCoreEMR modules

0.9.0(3mo ago)05.0k[1 issues](https://github.com/openCoreEMR/oce-lib-module-config/issues)1GPL-3.0-or-laterPHPPHP &gt;=8.2CI passing

Since Mar 11Pushed 2w agoCompare

[ Source](https://github.com/openCoreEMR/oce-lib-module-config)[ Packagist](https://packagist.org/packages/opencoreemr/oce-lib-module-config)[ Docs](https://opencoreemr.com)[ RSS](/packages/opencoreemr-oce-lib-module-config/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (9)Versions (11)Used By (1)

oce-lib-module-config
=====================

[](#oce-lib-module-config)

Shared configuration accessor library for OpenCoreEMR modules.

Extracts the duplicated config accessor pattern from OCE modules into a single Composer package. Each module provides a `ModuleConfigDescriptor` instead of copy-pasting six config classes.

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

[](#installation)

```
composer require opencoreemr/oce-lib-module-config
```

Usage
-----

[](#usage)

### 1. Define a module descriptor

[](#1-define-a-module-descriptor)

```
use OpenCoreEMR\ModuleConfig\ModuleConfigDescriptor;

$descriptor = new ModuleConfigDescriptor(
    yamlKeyMap: [
        'enabled' => 'oce_sinch_fax_enabled',
        'api_secret' => 'oce_sinch_fax_api_secret',
        // short YAML key => internal config key
    ],
    envOverrideMap: [
        'oce_sinch_fax_enabled' => 'OCE_SINCH_FAX_ENABLED',
        'oce_sinch_fax_api_secret' => 'OCE_SINCH_FAX_API_SECRET',
        // internal config key => env var name
    ],
    envConfigVar: 'OCE_SINCH_FAX_ENV_CONFIG',
    conventionalConfigPath: '/etc/oce/sinch-fax/config.yaml',
    conventionalSecretsPath: '/etc/oce/sinch-fax/secrets.yaml',
    configFileEnvVar: 'OCE_SINCH_FAX_CONFIG_FILE',
    secretsFileEnvVar: 'OCE_SINCH_FAX_SECRETS_FILE',
);
```

### 2. Create a config accessor

[](#2-create-a-config-accessor)

```
use OpenCoreEMR\ModuleConfig\ConfigFactory;
use OpenEMR\Core\OEGlobalsBag;

$factory = new ConfigFactory($descriptor, OEGlobalsBag::getInstance());
$config = $factory->createConfigAccessor();

$apiSecret = $config->getString('oce_sinch_fax_api_secret');
$enabled = $config->getBoolean('oce_sinch_fax_enabled');
$retryCount = $config->getInt('oce_sinch_fax_retry_count', 3);
```

The factory returns the right accessor based on what's available:

1. **YAML files exist** → `FileConfigAccessor` (reads YAML, resolves secrets, applies env overrides)
2. **Env config var set** → `EnvironmentConfigAccessor` (reads from env vars only)
3. **Neither** → `GlobalsAccessor` (reads from OEGlobalsBag / OpenEMR database settings)

### 3. YAML config with secret resolution (optional)

[](#3-yaml-config-with-secret-resolution-optional)

For secrets stored in Google Cloud Secret Manager, use a `_secrets` block in your secrets YAML:

```
# /etc/oce/sinch-fax/secrets.yaml
_secrets:
  provider: gcp-secret-manager
  project: my-tenant-project-id
  map:
    api_secret: fax_api_secret    # Terraform-provisioned secret name

# Non-secret values coexist as plain YAML
webhook_password_bcrypt_hash: "$2y$10$..."
```

Resolution order:

```
YAML loaded → imports processed → _secrets resolved → env var overrides applied

```

Env var overrides always win. The `google/cloud-secret-manager` library is a `suggest` dependency — it's only needed if you use `_secrets.provider: gcp-secret-manager`.

ConfigAccessorInterface
-----------------------

[](#configaccessorinterface)

All accessors implement four typed methods:

```
interface ConfigAccessorInterface
{
    public function getString(string $key, string $default = ''): string;
    public function getBoolean(string $key, bool $default = false): bool;
    public function getInt(string $key, int $default = 0): int;
    public function has(string $key): bool;
}
```

No `mixed` getter — consumers must use typed accessors.

Development
-----------

[](#development)

```
composer install
composer check    # php-lint, phpcs, phpstan
composer test     # phpunit
```

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.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 ~18 days

Total

2

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e3711ec05d536a75786ee9918fef942a50379ca1c5e241a3755c097153a6e89?d=identicon)[michael@opencoreemr.com](/maintainers/michael@opencoreemr.com)

---

Top Contributors

[![kojiromike](https://avatars.githubusercontent.com/u/1566303?v=4)](https://github.com/kojiromike "kojiromike (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (19 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

configurationmoduleopenemropencoreemr

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/opencoreemr-oce-lib-module-config/health.svg)

```
[![Health](https://phpackages.com/badges/opencoreemr-oce-lib-module-config/health.svg)](https://phpackages.com/packages/opencoreemr-oce-lib-module-config)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k246.0M11.1k](/packages/symfony-framework-bundle)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k181.3M2.2k](/packages/symfony-security-bundle)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19664.8M1.6k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M396](/packages/drupal-core-recommended)

PHPackages © 2026

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