PHPackages                             rstgroup/zf-external-config-module - 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. rstgroup/zf-external-config-module

ActiveLibrary

rstgroup/zf-external-config-module
==================================

Module responsible for fetching configuration from external sources.

1.0(8y ago)0361MITPHPPHP ^5.6 || ^7

Since Jul 26Pushed 8y ago13 watchersCompare

[ Source](https://github.com/rstgroup/zf-external-config-module)[ Packagist](https://packagist.org/packages/rstgroup/zf-external-config-module)[ RSS](/packages/rstgroup-zf-external-config-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (1)

ZF External Config Module
=========================

[](#zf-external-config-module)

This module provides the logic and abstraction for loading and merging application's configuration from external sources.

The module itself does not have any external provider yet, providers can be installed via Composer or written it your application's code.

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

[](#installation)

Require module with Composer:

```
composer require rstgroup/zf-external-config-module
```

The next step is adding module to ZF system configuration (`config/application.config.php`):

```
return [
    'modules' => [
        (...),
        'RstGroup\ZfExternalConfigModule',
    ],
    (...)
]
```

Adding providers
----------------

[](#adding-providers)

To load configuration from external source, the providers should be registered in your app's configuration:

```
return [
    'rst_group' => [
        'external_config' => [
            'providers' => [
                'YourProviderService' => true,
            ],
            'service_manager' => [
                'factories' => [
                    'YourProviderService' => YourProvidersServiceFactory::class
                ]
            ]
        ],
    ]
];
```

The module skims through enabled providers defined in:

```
rst_group.external_config.providers
```

and creates them using Inner Service Manager.

### Enabling and disabling providers

[](#enabling-and-disabling-providers)

Disabled providers, even though they are defined, don't participate in creation of final configuration.

Here's an example how to mark defined provider enabled or disabled:

```
return [
    'rst_group' => [
        'external_config' => [
            'providers' => [

                'EnabledProvider#1' => true,
                'EnabledProvider#2' => 'true',
                'EnabledProvider#3' => 'on',
                'EnabledProvider#4' => 1,

                'DisabledProvider#1' => false,
                'DisabledProvider#2' => 'false',
                'DisabledProvider#3' => 'off',
                'DisabledProvider#4' => 0,

            ],
        ],
    ],
];
```

### Inner Service Manager

[](#inner-service-manager)

In the example above you can see `service_manager` definition.

The module attaches itself to the configuration merge process, thus the application's default `ServiceManager`is not yet available. In order to keep the service manager's functionality, `zf-external-config-module`creates its own manager!

Your service can be created by factory, can be declared invokable etc. - the same way you normally declare services.

> But remember, this service ends its life just after external configuration is loaded and merged!

### Passing configuration to your providers

[](#passing-configuration-to-your-providers)

When defining your own providers you might require to pass some credentials or other parameters into the provider instance. To do so - the best way is to use factory functionality, because factories have the (inner) service manager injected!

Inner Service Manager has the application configuration and zf-external-config-module's configuration registered as services:

```
use Psr\Container\ContainerInterface;
use \RstGroup\ZfExternalConfigModule\Config\ExternalConfigListener;

final class ExampleServiceFactory {
    public function __invoke(ContainerInterface $container) {
        /* getting app's configuration */
        $appConfig = $container->get(
            ExternalConfigListener::SERVICE_APPLICATION_CONFIG
        );

        /* getting zf-external-config-module configuration */
        $moduleConfig = $container->get(
            ExternalConfigListener::SERVICE_EXTERNALS_CONFIG
        );

        (...)
    }
}
```

> Note that the `rst_group.external_config` key is removed from application's configuration, but you can still get it using module's config.

Writing your own provider
-------------------------

[](#writing-your-own-provider)

External config providers have to implement `\RstGroup\ZfExternalConfigModule\Config\ConfigProviderInterface`and be registered in module and inner service manager. Those are the only requirements!

You can store the code in your own application's codebase, but we recommend to share it with the community and publish it on GitHub &amp; Composer :) We'll gladly add your provider to this package's `suggest`ed providers!

Suggested providers
-------------------

[](#suggested-providers)

Consul KV Storage: [rstgroup/zf-external-config-consul-provider](https://github.com/rstgroup/zf-external-config-consul-provider)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3209d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ffa5d2fe34b04844f854a4fa7ce073c69a500fe6352d69461756abf1b23599d?d=identicon)[rstgroup](/maintainers/rstgroup)

---

Top Contributors

[![snapshotpl](https://avatars.githubusercontent.com/u/312655?v=4)](https://github.com/snapshotpl "snapshotpl (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rstgroup-zf-external-config-module/health.svg)

```
[![Health](https://phpackages.com/badges/rstgroup-zf-external-config-module/health.svg)](https://phpackages.com/packages/rstgroup-zf-external-config-module)
```

###  Alternatives

[zf-commons/zfc-user

A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.

4851.1M70](/packages/zf-commons-zfc-user)[zf-commons/zfc-base

A set of genetic (abstract) classes which are commonly used across multiple modules.

1441.1M25](/packages/zf-commons-zfc-base)

PHPackages © 2026

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