PHPackages                             pollen-solutions/wp-env - 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. pollen-solutions/wp-env

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

pollen-solutions/wp-env
=======================

Pollen Wordpress Env Component - Wordpress configuration with .env file.

v1.0.6(3y ago)14811MITPHPPHP ^7.4 || ^8.0

Since Sep 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pollen-solutions/wp-env)[ Packagist](https://packagist.org/packages/pollen-solutions/wp-env)[ Docs](https://www.presstify.com/pollen-solutions/wp-env/)[ RSS](/packages/pollen-solutions-wp-env/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (9)Used By (1)

Wordpress Env Component
=======================

[](#wordpress-env-component)

[![Latest Stable Version](https://camo.githubusercontent.com/9d736f955274f023091b0d5b53ee90f71b13c53a41e49144b3e4882959465cdd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f6c6c656e2d736f6c7574696f6e732f77702d656e762e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/pollen-solutions/wp-env)[![MIT Licensed](https://camo.githubusercontent.com/daa52099573be5a50c320c4387496400f2f722e49f86a42db8d5778130d3582d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666f722d7468652d6261646765)](LICENSE.md)[![PHP Supported Versions](https://camo.githubusercontent.com/d9d71d0b69072c51e1ff7adfdb6270f896f75787500ce6437120e23727c081d1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e342d3838393242463f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://www.php.net/supported-versions.php)

Pollen Solutions **Wordpress Env** Component provides a simply way to configure your Wordpress application.

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

[](#installation)

```
composer require pollen-solutions/wp-env
```

Replace the contents of wp-config.php file with the code below :

```
use Pollen\WpEnv\WpEnv;

// Optionnal but recommended start time global indicator
defined('START_TIME') ?: define('START_TIME', microtime(true));

require_once __DIR__ . '/vendor/autoload.php';

new WpEnv(__DIR__);

require_once(ABSPATH . 'wp-settings.php');
```

Configuration
-------------

[](#configuration)

### .env config file

[](#env-config-file)

#### Fondamentals

[](#fondamentals)

Create a .env file at the root of your project :

```
# ENVIRONMENT
## Environnement of your application.
## dev|prod.
APP_ENV=dev

## Enabling debug
APP_DEBUG=true

## Url of your application
APP_URL=https://127.0.0.1:8000

## Application timezone
APP_TIMEZONE=Europe/Paris

# PATH (Optionnal)
## Relative public path of your application
APP_PUBLIC_DIR=/
## Relative path to the wordpress root folder, containing wp-admin and wp-includes folder
APP_WP_DIR=/
## Relative path to the wp-content root folder, containing languages, themes, uploads ...
## MUST BE WRITABLE BY HTTP SERVER
APP_WP_PUBLIC_DIR=wp-content

# DATABASE
## DATABASE DRIVER
DB_CONNECTION=mysql
## DATABASE HOST
DB_HOST=127.0.0.1
## DATABASE PORT
DB_PORT=3306
## DATABASE NAME
DB_DATABASE=wordpress
## DATABASE USERNAME
DB_USERNAME=root
## DATABASE PASSWORD
DB_PASSWORD=root
## DATABASE TABLES PREFIX
DB_PREFIX=wp_

# WORDPRESS CONFIG
# @see https://wordpress.org/support/article/editing-wp-config-php/
WP_DEBUG_LOG=true
DISALLOW_FILE_MODS=true
AUTOMATIC_UPDATER_DISABLED=false
DISABLE_WP_CRON=false

## WORDPRESS SALT
## @see https://developer.wordpress.org/reference/functions/wp_salt/
## @see https://api.wordpress.org/secret-key/1.1/salt/
## Generate salt from cli :
## php vendor/bin/wp-salt dotenv --clean >> .env
```

#### Nesting Variables

[](#nesting-variables)

It's possible to nest an environment variable within another, useful to cut down on repetition.

This is done by wrapping an existing environment variable in ${…} e.g.

```
BASE_DIR=/var/webroot/project-root
CACHE_DIR=${BASE_DIR}/cache
TMP_DIR=${BASE_DIR}/tmp
```

#### Overwriting

[](#overwriting)

It's possible to overwrite environment variable within another throught .env.local file.

```
# > .env file
BASE_DIR=/var/webroot/common-project-root
```

```
# > .env.local file
BASE_DIR=/var/webroot/local-project-root
```

### .wp-config.local config file

[](#wp-configlocal-config-file)

Same as the original wp-config.php file, the wp-config.local.php file at the root of your project allow to define constants of your Wordpress application.

```
use Pollen\Support\Env;
use Pollen\Support\Filesystem as fs;

// LOGS
if (!defined('WP_DEBUG_LOG')) {
    define('WP_DEBUG_LOG', getcwd() . fs::DS . 'var' . fs::DS . 'log' . fs::DS . 'error.log');
}

// AUTHENTICATION
if (!defined('COOKIE_DOMAIN')) {
    define('COOKIE_DOMAIN', Env::get('DOMAIN_CURRENT_SITE'));
}
if (!defined('COOKIEPATH')) {
    define('COOKIEPATH', '/');
}
if (!defined('SITECOOKIEPATH')) {
    define('SITECOOKIEPATH', '/');
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~68 days

Recently: every ~119 days

Total

8

Last Release

1228d ago

### Community

Maintainers

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

---

Top Contributors

[![jordy-manner](https://avatars.githubusercontent.com/u/733356?v=4)](https://github.com/jordy-manner "jordy-manner (5 commits)")

---

Tags

phpwordpresswordpresswp-configwp-envpollen-solutions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pollen-solutions-wp-env/health.svg)

```
[![Health](https://phpackages.com/badges/pollen-solutions-wp-env/health.svg)](https://phpackages.com/packages/pollen-solutions-wp-env)
```

###  Alternatives

[roots/bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure

6.5k441.8k2](/packages/roots-bedrock)[php-stubs/wordpress-stubs

WordPress function and class declaration stubs for static analysis.

19013.0M263](/packages/php-stubs-wordpress-stubs)

PHPackages © 2026

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