承接 davekellam/dont-mess-up-prod 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

Environment indicator screenshot

See a live preview on Playground.

Installation

Manual

  1. Upload the plugin files to /wp-content/plugins/dont-mess-up-prod/
  2. Activate the plugin through the "Plugins" screen in WordPress
  3. 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:

  1. 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.

  2. wp_get_environment_type() – Which defaults to production and 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 davekellam/dont-mess-up-prod 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 54
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2025-11-12