sjmb/module-environment-info 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sjmb/module-environment-info

最新稳定版本:1.0.0

Composer 安装命令:

composer require sjmb/module-environment-info

包简介

Displays a configurable visual environment indicator on admin and frontend pages for Magento 2

README 文档

README

Displays a configurable visual environment indicator on every admin page to identify the current hostname.

Overview

Sjmb_EnvironmentInfo injects a small UI element into the Magento 2 admin panel so developers and administrators can immediately identify which environment (staging, production, local) they are working in. The indicator is driven entirely by system configuration: it can be globally disabled, always enabled, or restricted to a list of specific hostnames. Three visual styles are available — a top bar, a corner badge, and a dismissible alert — each rendered via a dedicated template.

Requirements

  • Magento 2.4.x or higher
  • PHP 8.3 or higher
  • No external module dependencies declared

Installation

Composer installation

Run command to install module:

composer require --dev sjmb/module-environment-info

Manual installation

Download module and place in directory <magento-root>/app/code/Sjmb/EnvironmentInfo

Enable the module

php bin/magento module:enable Sjmb_EnvironmentInfo
php bin/magento setup:upgrade
php bin/magento cache:flush

Configuration

CLI

To enable display info can use CLI command:

php bin/magento config:set sjmb_env_info/general/mode 1

To save config to app/etc/env.php can add flag --lock-env:

php bin/magento config:set sjmb_env_info/general/mode 1 --lock-env

env.php

To enable display by app/etc/env.php can add bellow code:

...
'system' => [
    'default' => [
        'sjmb_env_info' => [
            'general' => [
                'mode' => '1'
            ]
        ]
    ]
]
...

Admin panel

Navigate to Stores > Configuration > SJMB > Environment Info > General Settings.

Config path UI label Type Default Description
sjmb_env_info/general/mode Display Mode select 0 (Disabled) Controls when the indicator is shown
sjmb_env_info/general/display_type Display Type select topbar Visual style of the indicator; hidden when mode is Disabled
sjmb_env_info/general/allowed_domains Allowed Domains dynamic rows (JSON) List of hostnames; visible only when Display Mode is Selected Domains

Display Mode values

Value Label Behaviour
0 Disabled Indicator is never rendered
1 Enabled Indicator is rendered on every admin page
2 Selected Domains Indicator is rendered only when HTTP_HOST matches an entry in Allowed Domains

Display Type values

Value Template Visual description
topbar topbar.phtml Fixed full-width orange bar at the top of the page; JS adjusts body top margin to prevent overlap
corner corner.phtml Small purple badge fixed in the bottom-right corner; pointer-events: none
alert alert.phtml Dismissible orange bar fixed below the top navigation (top: 60px); includes a close button

Features

  • Admin system configuration section under Stores > Configuration > SJMB > Environment Info.
  • Three display modes: Disabled, Enabled, and Selected Domains.
  • Three visual indicator styles: topbar, corner badge, dismissible alert.
  • Selected Domains mode performs an exact HTTP_HOST match against a JSON-serialized list of domain rows configured via a dynamic-rows UI field.

Usage

Enable with topbar on all pages

  1. Go to Stores > Configuration > SJMB > Environment Info.
  2. Set Display Mode to Enabled.
  3. Set Display Type to Topbar.
  4. Save configuration and flush cache.

Restrict to specific environments by hostname

  1. Set Display Mode to Selected Domains.
  2. In the Allowed Domains grid, add one row per hostname (e.g. staging.example.com).
  3. Set Display Type to the desired style.
  4. Save configuration and flush cache.

The indicator will appear only when the admin is accessed from a matching hostname.

Info

Copyright (c) 2026 SJMB · Code in 🐻‍❄️ in 🇵🇱

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-03-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固