davekellam/dont-mess-up-prod
Composer 安装命令:
composer require davekellam/dont-mess-up-prod
包简介
A WordPress plugin to indicate which environment you're currently using in the admin bar
关键字:
README 文档
README
This plugin displays a colored environment indicator in the WordPress admin bar to help developers and content managers identify which environment they're working in.
See a live preview on Playground.
Installation
Manual
- Upload the plugin files to
/wp-content/plugins/dont-mess-up-prod/ - Activate the plugin through the "Plugins" screen in WordPress
- Configure the plugin via the Settings → Don’t Mess Up Prod screen (or filters)
Composer
composer require davekellam/dont-mess-up-prod
Environment Detection
The plugin detects the current environment using this priority order:
-
URL matching – Compares the current site URL against the configured environment URLs. This list will also be used to generate a list of links that appears on hover in the admin bar.
-
wp_get_environment_type()– Which defaults toproductionand can be set via php constant:define( 'WP_ENVIRONMENT_TYPE', 'staging' );
The indicator is visible to users who either meet the minimum capability (defaults to publish_posts, filterable via dmup_minimum_capability) or whose username appears in the allowed users filter. This keeps visibility limited to the folks who need the context.
Configuration
The plugin can be configured using the WordPress admin screen or using filters.
Admin Settings
Go to Settings → Don’t Mess Up Prod to configure:
- Colors for each environment (local, development, staging, production)
- URLs for each environment (used for detection and quick links)
Settings are saved per environment, and defaults are provided out of the box.
Example Configuration (mu-plugin)
Create a file /wp-content/mu-plugins/dmup-config.php:
<?php /** * Plugin Name: Don't Mess Up Prod Configuration */ /** * Configure minimum capability for the environment indicator * * By default, the plugin only shows to explicitly allowed users. * Use this filter to enable role-based access. * * @param string|false $capability Current capability setting. * @return string|false Modified capability setting. */ function dmup_set_minimum_capability( $capability ) { // Enable for Author level and above return 'publish_posts'; } add_filter( 'dmup_minimum_capability', 'dmup_set_minimum_capability' ); /** * Configure allowed users for the environment indicator * * Add specific user logins that should see the environment indicator * regardless of their role level. * * @param array $users Current allowed users array. * @return array Modified allowed users array. */ function dmup_set_allowed_users( $users ) { // Add specific user logins here $project_users = [ 'developer-name', 'content-manager-name', ]; return array_merge( $users, $project_users ); } add_filter( 'dmup_allowed_users', 'dmup_set_allowed_users' ); /** * Configure environment URLs for your project * * Customize the URLs used to detect different environments and populate child links under the admin bar menu item * * @param array $urls Current environment URLs array. * @return array Modified environment URLs array. */ function dmup_set_environment_urls( $urls ) { return [ 'local' => 'http://yourproject.local', 'development' => 'https://dev.yourproject.com', 'staging' => 'https://staging.yourproject.com', 'production' => 'https://yourproject.com', ]; } add_filter( 'dmup_environment_urls', 'dmup_set_environment_urls' ); /** * Configure environment colors for your project * * Customize the colors used for each environment * * @param array $colors Current environment colors array. * @return array Modified environment colors array. */ function dmup_set_environment_colors( $colors ) { return [ 'local' => '#17a2b8', // blue 'development' => '#6f42c1', // purple 'staging' => '#ffc107', // yellow 'production' => '#dc3545', // red ]; } // Note: Admin settings are applied at priority 20. // If you want to override admin settings in code, use a higher priority. add_filter( 'dmup_environment_colors', 'dmup_set_environment_colors', 30 );
License
GPL-2.0-or-later
davekellam/dont-mess-up-prod 适用场景与选型建议
davekellam/dont-mess-up-prod 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 54 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「wordpress」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 davekellam/dont-mess-up-prod 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 davekellam/dont-mess-up-prod 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 davekellam/dont-mess-up-prod 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Plugin for YOURLS. Default tools to use in some laemmi plugins
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
Allows polling user for event dates and times.
Support swipe touch gestures to navigate in paginated lists and on Tidypics image pages.
Add a postscript to every email notification sent out to users.
统计信息
- 总下载量: 54
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-11-12
