{"id":36982353,"url":"https://github.com/wierklu/envpress","last_synced_at":"2026-01-13T22:52:16.975Z","repository":{"id":219296357,"uuid":"748320224","full_name":"wierklu/envpress","owner":"wierklu","description":"PHP package streamlining the configuration of WordPress instances using env vars.","archived":false,"fork":false,"pushed_at":"2025-05-16T20:53:51.000Z","size":116,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-29T06:49:35.727Z","etag":null,"topics":["config","php","wordpress"],"latest_commit_sha":null,"homepage":"","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/wierklu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-25T18:23:42.000Z","updated_at":"2025-10-25T12:22:04.000Z","dependencies_parsed_at":"2024-02-03T11:24:09.838Z","dependency_job_id":"433ac633-3e21-4472-ac47-b75905e96868","html_url":"https://github.com/wierklu/envpress","commit_stats":null,"previous_names":["wierkstudio/envpress","wierklu/envpress"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wierklu/envpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wierklu%2Fenvpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wierklu%2Fenvpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wierklu%2Fenvpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wierklu%2Fenvpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wierklu","download_url":"https://codeload.github.com/wierklu/envpress/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wierklu%2Fenvpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["config","php","wordpress"],"created_at":"2026-01-13T22:52:16.888Z","updated_at":"2026-01-13T22:52:16.957Z","avatar_url":"https://github.com/wierklu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EnvPress\n\nA PHP package streamlining the configuration of modern and secure WordPress instances using a standard set of environment variables.\n\n## Key Features\n\n- Designed for [Composer](https://getcomposer.org/) based WordPress setups (e.g. [Bedrock](https://roots.io/bedrock/))\n- Static wp-config.php\n- Load environment variables from .env files with [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv)\n- Gather facts from trusted proxies (e.g. Load Balancers)\n- Attach [backing services](https://www.12factor.net/backing-services) using URLs (e.g. MySQL, SMTP)\n- Configure [Multisite Networks](https://wordpress.org/documentation/article/create-a-network/) using environment variables\n- Apply role and capability changes based on env vars\n- Disable native WordPress features using flags (e.g. XML-RPC, comments, oEmbed)\n- Harden WordPress by default: Disable file modifications and hide version\n\n## Motivation\n\nThe standard setup of WordPress involves maintaining a wp-config.php file for setting basic configuration options, such as paths, the database connection, and security salts. Except for the actual configuration values, the source code of this file is repeated for each instance with little to no variation. Other common configurations, such as SMTP server credentials and disabling XML-RPC, must be handled separately, far away from wp-config.php, in a custom (child) theme or using multiple third-party plugins.\n\nThis package is designed to simplify the configuration process and lessen the maintenance workload for the majority of WordPress instances. It relies on a standard set of environment variables (see list below), rather than boilerplate PHP code, to configure an instance.\n\n## Getting Started\n\n1.  Setup Composer based WordPress project:\n\n    The easiest way to do so, is [creating a new Bedrock project](https://roots.io/bedrock/docs/installation/) using Composer:\n\n    ```bash\n    composer create-project roots/bedrock\n    ```\n\n2.  Install this package via Composer:\n\n    ```bash\n    composer require wierk/envpress\n    ```\n\n3.  Set up environment variables:\n\n    Configure environment variables in the web server or PHP config (recommended for production) or, alternatively, add them to a file named .env in the root of the project (common for development).\n\n    Minimal set of environment variables to run a WordPress instance:\n\n    ```ini\n    WP_HOME      = https://example.com\n    WP_SITEURL   = https://example.com/wp\n    DATABASE_URL = mysql://username:password@hostname:port/database\n    ```\n\n    Set of env vars providing WordPress salts:\n\n    ```ini\n    SALT_AUTH_KEY         = put your unique phrase here\n    SALT_SECURE_AUTH_KEY  = put your unique phrase here\n    SALT_LOGGED_IN_KEY    = put your unique phrase here\n    SALT_NONCE_KEY        = put your unique phrase here\n    SALT_AUTH_SALT        = put your unique phrase here\n    SALT_SECURE_AUTH_SALT = put your unique phrase here\n    SALT_LOGGED_IN_SALT   = put your unique phrase here\n    SALT_NONCE_SALT       = put your unique phrase here\n    ```\n\n4.  Replace the content of wp-config.php with the following:\n\n    ```php\n    \u003c?php\n    require_once dirname(__DIR__) . '/vendor/autoload.php';\n    \\EnvPress\\EnvPress::createWithBedrockDefaults(__DIR__)-\u003ebootstrap();\n    require_once ABSPATH . 'wp-settings.php';\n    ```\n\n    Starting from the Bedrock boilerplate, the root config directory may now be removed.\n\n## Environment Variables\n\nEnvPress sets up a WordPress instance using a collection of environment variables, listed in the following table. In cases where an environment variable is absent, the corresponding default value is used. These default values are selected to closely resemble a standard, unmodified WordPress installation to avoid unintentional changes. Env vars prefixed `APP_` are explicitly reserved for the underlying application and will never be used by this package.\n\n| Environment variable | Comments | Default |\n| ----------- | ----------- | ------- |\n| `WP_HOME` | [URL the WordPress instance can be reached at](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#blog-address-url) | Required |\n| `WP_SITEURL` | [URL where WordPress core files reside](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wp-siteurl) | Required |\n| `WP_ENVIRONMENT_TYPE` | [Environment type](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wp-environment-type) | `production` |\n| `WP_DEBUG` | Flag to enable [the reporting of some errors or warnings](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wp-debug) | `false` |\n| `WP_CACHE` | Flag to enable [advanced-cache.php](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#cache) | `false` |\n| `WP_CRON` | Flag to enable [WP Cron based on page load](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#alternative-cron) | `true` |\n| `WP_FILE_MODS` | Flag to enable [plugin and theme installation/update](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#disable-plugin-and-theme-update-and-installation) | `true` |\n| `WP_DEFAULT_THEME` | Default WordPress theme name | WordPress default |\n| `WP_POST_REVISIONS` | Number of [post revisions](https://wordpress.org/documentation/article/revisions/) (-1, 0, 1, 2, …) | `-1` |\n| `WP_ALLOW_REPAIR` | Flag to enable [automatic database repair support](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#automatic-database-optimizing) | `false` |\n| `WP_ROLES_PATCH` | JSON-encoded set of [role and capability](https://wordpress.org/documentation/article/roles-and-capabilities/) changes | No changes |\n| `MULTISITE_ALLOW` | Flag to allow a [multisite network](https://wordpress.org/documentation/article/create-a-network/) | `false` |\n| `MULTISITE_ENABLE` | Flag to enable a multisite network, once installed | `false` |\n| `MULTISITE_TYPE` | Either `subdomains` or `subdirectories` | `subdirectories` |\n| `MULTISITE_DOMAIN` | Value of `DOMAIN_CURRENT_SITE` | Required for MS |\n| `MULTISITE_PATH` | Value of `PATH_CURRENT_SITE` | Required for MS |\n| `DATABASE_URL` | MySQL server URL (see below) | Required |\n| `DATABASE_CHARSET` | Database [character set](https://wordpress.org/documentation/article/wordpress-glossary/#character-set) | `utf8mb4` |\n| `DATABASE_COLLATE` | Database [collation](https://wordpress.org/documentation/article/wordpress-glossary/#collation) | Empty |\n| `DATABASE_PREFIX` | Database [table prefix](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#table-prefix) | `wp_` |\n| `MAILER_FROM_ADDRESS` | Sender email address (may be set in `MAILER_URL`) | WordPress default |\n| `MAILER_FROM_NAME` | Sender name | WordPress default |\n| `MAILER_URL` | SMTP server URL for outgoing mail (see below) | WordPress default |\n| `FEATURE_COMMENTS` | Enable comments and related features | `true` |\n| `FEATURE_EMOJI` | Enable support for emojis in older browsers | `true` |\n| `FEATURE_OEMBED` | Enable oEmbed and related features | `true` |\n| `FEATURE_XMLRPC` | Enable XML-RPC (incl. pingbacks) | `true` |\n| `SALT_AUTH_KEY` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_SECURE_AUTH_KEY` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_LOGGED_IN_KEY` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_NONCE_KEY` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_AUTH_SALT` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_SECURE_AUTH_SALT` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_LOGGED_IN_SALT` | Cryptographically strong and random key | `put your uni…` |\n| `SALT_NONCE_SALT` | Cryptographically strong and random key | `put your uni…` |\n| `ADMIN_SUPPORT_NAME` | Support contact name | Empty |\n| `ADMIN_SUPPORT_URL` | Support contact website URL | Empty |\n| `ADMIN_DASHBOARD_DISABLE` | CSV of dashboard widget ids to be disabled | Empty |\n| `ADMIN_DISPLAY_ENV` | Flag to display the environment type in admin | `false` |\n| `TRACKING_FATHOM` | [Fathom Analytics](https://usefathom.com/) Site id | Empty |\n| `TRACKING_GTM` | [Google Tag Manager](https://marketingplatform.google.com/about/tag-manager/) Container id | Empty |\n| `SERVICE_SENTRY_DSN` | DSN for error reporting with [Sentry](https://sentry.io/) | Not used |\n| `PLUGIN_ACF_PRO_LICENSE` | License key for [ACF PRO](https://www.advancedcustomfields.com/pro/) | Empty (disabled) |\n| `RELEASE_VERSION` | Display version of the release | Empty |\n| `RELEASE_URL` | Website URL of the release | Empty |\n| `ENVPRESS_TRUSTED_PROXIES` | CSV of trusted proxy addresses | Empty (disabled) |\n\n## Connect Backing Services via URLs\n\nBacking services such as databases, caching systems, or SMTP servers are attached using URLs. These URLs consolidate all the essential connection details, like host name, port, access credentials, and other relevant parameters, into a singular, manageable string.\n\nIn URLs, if a user name or password contains special characters (`$\u0026+,/:;=?@`), they must be [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding).\n\n### Database URL/DSN\n\n```ini\nDATABASE_URL=mysql://${USER}:${PASS}@${HOST}:${PORT}/${DATABASE}?ssl-mode=REQUIRED\n```\n\nQuery parameters:\n\n- `ssl-mode` - If set to `REQUIRED`, requires an encrypted connection and fails, if one cannot be established.\n\n### Mailer URL\n\n```ini\nMAILER_URL=smtp://${USER}:${PASS}@${HOST}:${PORT}?encryption=tls\n```\n\nQuery parameters:\n\n- `encryption` - Define the encryption to use on the SMTP connection: `tls` (default) or `ssl`.\n- `from` - If present, force the from email address to a specified one, overwriting `MAILER_FROM_ADDRESS`.\n\n## Patching Roles and Capabilities\n\nThe `WP_ROLES_PATCH` environment variable allows role and capability changes to be defined using a JSON-encoded structure. Each top-level key is a role name, and each value describes changes for that role. Patches are applied only once per unique configuration using an internal hash that is stored in `wp_options`. In a multisite network, changes are applied to each site.\n\nSupported role object attributes:\n\n- `display_name` - Optional display name used when creating a new role (see [add_role](https://developer.wordpress.org/reference/functions/add_role/))\n- `add_cap` - Capability or array of capabilities to add and grant (see [WP_Role::add_cap](https://developer.wordpress.org/reference/classes/wp_role/add_cap/))\n- `remove_cap` - Capability or array of capabilities to remove (see [WP_Role::remove_cap](https://developer.wordpress.org/reference/classes/wp_role/remove_cap/))\n- `deny_cap` - Capability or array of capabilities to add and explicitly deny (relevant for multi-role users)\n- `remove_role` - Set to `true` to delete the role entirely (see [remove_role](https://developer.wordpress.org/reference/functions/remove_role/))\n\nExample:\n\n```ini\nWP_ROLES_PATCH={\"editor\":{\"add_cap\":[\"create_users\",\"list_users\"],\"remove_cap\":\"delete_users\"},\"unused\":{\"remove_role\":true}}\n```\n\nThis adds the capabilities `create_users` and `list_users` to the `editor` role, removes `delete_users`, and deletes the `unused` role.\n\n## Configure Error Reporting with Sentry\n\nSign up for a [Sentry account](https://sentry.io/) and create a project to obtain a Sentry DSN. To enable frontend error reporting, provide the DSN in the `SERVICE_SENTRY_DSN` environment variable.\n\nSentry is treated as a **peer dependency**: This package will use it if available but won’t install it for you. To activate Sentry error reporting for PHP, install the [Sentry SDK for PHP](https://github.com/getsentry/sentry-php) via Composer:\n\n```bash\ncomposer require sentry/sentry:^4.0\n```\n\n## Credits\n\nCreated and maintained by [Wierk](https://wierk.lu/?utm_source=envpress\u0026utm_medium=referral\u0026utm_campaign=open_source_projects) and [contributors](https://github.com/wierkstudio/envpress/graphs/contributors). Released under the [MIT license](./LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwierklu%2Fenvpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwierklu%2Fenvpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwierklu%2Fenvpress/lists"}