PHPackages                             nyco/wp-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. nyco/wp-config

ActiveWordpress-muplugin[Parsing &amp; Serialization](/categories/parsing)

nyco/wp-config
==============

A WordPress package for environment configuration.

1.0.5(4y ago)02581[3 PRs](https://github.com/CityOfNewYork/nyco-wp-config/pulls)GPL-3.0+PHPCI passing

Since Mar 29Pushed 1y ago14 watchersCompare

[ Source](https://github.com/CityOfNewYork/nyco-wp-config)[ Packagist](https://packagist.org/packages/nyco/wp-config)[ Docs](https://github.com/cityofnewyork/nyco-wp-config)[ RSS](/packages/nyco-wp-config/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (2)Dependencies (4)Versions (19)Used By (0)

NYCO WP Config
==============

[](#nyco-wp-config)

A developer plugin for WordPress that sets constants and WordPress Options for an installation through a YAML configuration file and autoloads environment specific configuration scripts.

Features
--------

[](#features)

- Define constants from a **.yml** file.
- Set WordPress options from the same **.yml** file.
- Optionally encrypt the **.yml** file secrets.
- Autoload default **.php** configuration file.
- Autoload environment specific **.php** configuration file.

Installation using [Composer](https://getcomposer.org/)
-------------------------------------------------------

[](#installation-using-composer)

**$1** This package uses [Composer Installers](https://github.com/composer/installers) to install the package in the **Must Use** plugins directory (*/wp-content/mu-plugins*):

```
composer require nyco/wp-config

```

*Not using Composer?* Download an archive of the code and drop it into the mu-plugins directory.

**$2** [Create a proxy PHP loader file](https://wordpress.org/support/article/must-use-plugins/#caveats) inside the mu-plugins directory, or [use the one included with the plugin](https://github.com/CityOfNewYork/wp-config/blob/master/autoloader-sample.php):

```
mv wp-content/mu-plugins/wp-config/autoloader-sample.php wp-content/mu-plugins/@config.php

```

Usage
-----

[](#usage)

### Recommendations

[](#recommendations)

Secure the **config.yml** file and **env.php** described below by A) using the encryption method to encrypt the secrets file and B) not checking either file into your site's source control.

### Configuration

[](#configuration)

The package comes with a sample config directory **/config-sample**. Copy the directory, place into the **mu-plugins**, and rename it to **config**.

```
mv wp-content/mu-plugins/wp-config/config-sample wp-content/mu-plugins/config

```

In the directory you'll find the following files:

**default.php** - This is the default configuration script for writing global configurations for your site.

**development.php** - This is a sample configuration script that would be required if you set the `WP_ENV` constant to `development`. You can add as many environments as you would like, but you need to set them (see below).

**config.yml** - This file will be automatically loaded and read for your different environments. For example:

```
development:
    SOME_VAR: someVarHere

```

The `SOME_VAR` constant would be set for your development environment. It would be available to your WordPress plugins and themes through `SOME_VAR` or `constant('SOME_VAR')`. You can add as many environments as you would like, but you need to set them (see below). *It is recommended to add the **config.yml** file to your **.gitignore** if you are storing private keys so they aren't committed to source control*.

### Setting your environment

[](#setting-your-environment)

Simply add the following to your **wp-config.php** to set your environment variable:

```
$_ENV['WP_ENV'] = 'development';
define('WP_ENV', $_ENV['WP_ENV']);

```

### Setting WordPress Options

[](#setting-wordpress-options)

To set database options in the WordPress Installation, prefix the the variables in the **config.yml** file with `WP_OPTION_`. For example:

```
development:
    WP_OPTION_SOME_VAR: someVarHere

```

### Encryption

[](#encryption)

The encryption method is optional. To utilize this method, you will need to generate a secret key to encrypt and decrypt your **config.yml** secrets.

1. Clone or download the repository down and `cd` into the directory.
2. Run `php Secret.php`. This will generate a new secret key in an **env.php** file.
3. Place your **config.yml** from the **mu-plugins/config** directory you created into the same directory and run `php Encrypt.php` to encrypt the file.
4. Add the **env.php** to the **mu-plugins/wp-config** plugin directory in your WordPress installation.
5. Add the **config.yml** file back to the **mu-plugins/config** directory.

*It is recommended to add the **config.yml** and **env.php** file to your **.gitignore** if you are storing private keys so they aren't committed to source control*.

### Hooks

[](#hooks)

The action `nyco_wp_config_loaded` is fired after the **default.php**, **environment.php**, and **config.yml** file are loaded and variables are set.

### Contributing

[](#contributing)

Clone repository and create feature branch. Make changes and run `composer run lint` to follow the coding specification. `composer run format` can help fix some of the issues.

---

[![The Mayor's Office for Economic Opportunity](NYCMOEO_SecondaryBlue256px.png)](NYCMOEO_SecondaryBlue256px.png)

[The Mayor's Office for Economic Opportunity](http://nyc.gov/opportunity) (NYC Opportunity) is committed to sharing open source software that we use in our products. Feel free to ask questions and share feedback. **Interested in contributing?** See our open positions on [buildwithnyc.github.io](http://buildwithnyc.github.io/). Follow our team on [Github](https://github.com/orgs/CityOfNewYork/teams/nycopportunity) (if you are part of the [@cityofnewyork](https://github.com/CityOfNewYork/) organization) or [browse our work on Github](https://github.com/search?q=nycopportunity).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 95.7% 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 ~110 days

Recently: every ~172 days

Total

14

Last Release

1535d ago

Major Versions

0.2.0 → 1.0.02019-11-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/a772d4b08a51649d663a68fb04b475b0c50cd6b7b0a8d74d8fa922ab69ee8945?d=identicon)[nycopportunity](/maintainers/nycopportunity)

---

Top Contributors

[![devowhippit](https://avatars.githubusercontent.com/u/3826974?v=4)](https://github.com/devowhippit "devowhippit (22 commits)")[![kimpenguin](https://avatars.githubusercontent.com/u/4793915?v=4)](https://github.com/kimpenguin "kimpenguin (1 commits)")

---

Tags

civic-techcomposerconfigenvironmentmust-usenycopportunityphppluginwordpresswordpress-pluginyamlwordpressconfigurationenvironmentconstants

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[pods-framework/pods

Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress.

1.1k1.7k](/packages/pods-framework-pods)[wpreadme2markdown/wpreadme2markdown

Convert WordPress Plugin readme.txt to Markdown

9564.6k4](/packages/wpreadme2markdown-wpreadme2markdown)[wpreadme2markdown/wp2md

CLI tool for converting WordPress Plugin readme.txt to Markdown

1961.7k4](/packages/wpreadme2markdown-wp2md)[freshsystems/wp-acf-markdown-field

Adds a Markdown field to Advanced Custom Fields.

159.2k](/packages/freshsystems-wp-acf-markdown-field)

PHPackages © 2026

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