{"id":20309550,"url":"https://github.com/pollen-solutions/wp-env","last_synced_at":"2026-05-09T01:40:38.706Z","repository":{"id":57043459,"uuid":"394600037","full_name":"pollen-solutions/wp-env","owner":"pollen-solutions","description":"Pollen Solutions - WP Env Component - Wordpress configuration with .env file","archived":false,"fork":false,"pushed_at":"2022-12-29T17:36:10.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T12:43:24.792Z","etag":null,"topics":["php","wordpress"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pollen-solutions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-10T09:42:48.000Z","updated_at":"2022-10-06T12:02:17.000Z","dependencies_parsed_at":"2023-01-31T09:31:12.018Z","dependency_job_id":null,"html_url":"https://github.com/pollen-solutions/wp-env","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-solutions%2Fwp-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-solutions%2Fwp-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-solutions%2Fwp-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pollen-solutions%2Fwp-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pollen-solutions","download_url":"https://codeload.github.com/pollen-solutions/wp-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241809603,"owners_count":20023786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","wordpress"],"created_at":"2024-11-14T17:27:46.120Z","updated_at":"2026-05-09T01:40:38.681Z","avatar_url":"https://github.com/pollen-solutions.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wordpress Env Component\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/pollen-solutions/wp-env.svg?style=for-the-badge)](https://packagist.org/packages/pollen-solutions/wp-env)\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](LICENSE.md)\n[![PHP Supported Versions](https://img.shields.io/badge/PHP-\u003e=7.4-8892BF?style=for-the-badge\u0026logo=php)](https://www.php.net/supported-versions.php)\n\nPollen Solutions **Wordpress Env** Component provides a simply way to configure your Wordpress application.\n\n## Installation\n\n```bash\ncomposer require pollen-solutions/wp-env\n```\n\nReplace the contents of wp-config.php file with the code below :\n\n```php\nuse Pollen\\WpEnv\\WpEnv;\n\n// Optionnal but recommended start time global indicator\ndefined('START_TIME') ?: define('START_TIME', microtime(true));\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\nnew WpEnv(__DIR__);\n\nrequire_once(ABSPATH . 'wp-settings.php');\n```\n\n## Configuration\n\n### .env config file\n\n#### Fondamentals\n\nCreate a .env file at the root of your project :\n\n```dotenv\n# ENVIRONMENT\n## Environnement of your application. \n## dev|prod. \nAPP_ENV=dev\n\n## Enabling debug\nAPP_DEBUG=true\n\n## Url of your application\nAPP_URL=https://127.0.0.1:8000\n\n## Application timezone\nAPP_TIMEZONE=Europe/Paris\n\n# PATH (Optionnal)\n## Relative public path of your application \nAPP_PUBLIC_DIR=/\n## Relative path to the wordpress root folder, containing wp-admin and wp-includes folder \nAPP_WP_DIR=/\n## Relative path to the wp-content root folder, containing languages, themes, uploads ...\n## MUST BE WRITABLE BY HTTP SERVER \nAPP_WP_PUBLIC_DIR=wp-content\n\n# DATABASE\n## DATABASE DRIVER\nDB_CONNECTION=mysql\n## DATABASE HOST\nDB_HOST=127.0.0.1\n## DATABASE PORT\nDB_PORT=3306\n## DATABASE NAME\nDB_DATABASE=wordpress\n## DATABASE USERNAME\nDB_USERNAME=root\n## DATABASE PASSWORD\nDB_PASSWORD=root\n## DATABASE TABLES PREFIX\nDB_PREFIX=wp_\n\n# WORDPRESS CONFIG\n# @see https://wordpress.org/support/article/editing-wp-config-php/\nWP_DEBUG_LOG=true\nDISALLOW_FILE_MODS=true\nAUTOMATIC_UPDATER_DISABLED=false\nDISABLE_WP_CRON=false\n\n## WORDPRESS SALT\n## @see https://developer.wordpress.org/reference/functions/wp_salt/\n## @see https://api.wordpress.org/secret-key/1.1/salt/\n## Generate salt from cli :\n## php vendor/bin/wp-salt dotenv --clean \u003e\u003e .env\n```\n\n#### Nesting Variables\n\nIt's possible to nest an environment variable within another, useful to cut down on repetition.\n\nThis is done by wrapping an existing environment variable in ${…} e.g.\n\n```dotenv\nBASE_DIR=/var/webroot/project-root\nCACHE_DIR=${BASE_DIR}/cache\nTMP_DIR=${BASE_DIR}/tmp\n```\n\n#### Overwriting\n\nIt's possible to overwrite environment variable within another throught .env.local file.\n\n```dotenv\n# \u003e .env file\nBASE_DIR=/var/webroot/common-project-root\n```\n\n```dotenv\n# \u003e .env.local file\nBASE_DIR=/var/webroot/local-project-root\n```\n\n### .wp-config.local config file\n\nSame as the original wp-config.php file, the wp-config.local.php file at the root of your project allow to define \nconstants of your Wordpress application.\n\n```php\nuse Pollen\\Support\\Env;\nuse Pollen\\Support\\Filesystem as fs;\n\n// LOGS\nif (!defined('WP_DEBUG_LOG')) {\n    define('WP_DEBUG_LOG', getcwd() . fs::DS . 'var' . fs::DS . 'log' . fs::DS . 'error.log');\n}\n\n// AUTHENTICATION\nif (!defined('COOKIE_DOMAIN')) {\n    define('COOKIE_DOMAIN', Env::get('DOMAIN_CURRENT_SITE'));\n}\nif (!defined('COOKIEPATH')) {\n    define('COOKIEPATH', '/');\n}\nif (!defined('SITECOOKIEPATH')) {\n    define('SITECOOKIEPATH', '/');\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpollen-solutions%2Fwp-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpollen-solutions%2Fwp-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpollen-solutions%2Fwp-env/lists"}