pxlrbt/filament-environment-indicator 问题修复 & 功能扩展

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

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

pxlrbt/filament-environment-indicator

最新稳定版本:v3.3.1

Composer 安装命令:

composer require pxlrbt/filament-environment-indicator

包简介

Indicator for the current environment inside Filament

README 文档

README

header

Filament Environment Indicator

Latest Version on Packagist Software License GitHub Workflow Status Total Downloads

Never confuse your tabs with different Filament environments again.

Screenshot

Installation via Composer

Plugin Version Filament Version PHP Version
1.x ^2.9.15 > 8.0
2.x 3.x > 8.1
3.x 4.x > 8.1
composer require pxlrbt/filament-environment-indicator

Usage

To use this plugin register it in your panel configuration:

use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;

$panel
    ->plugins([
        EnvironmentIndicatorPlugin::make(),
    ]);

Configuration

Out of the box, this plugin adds a colored border to the top of the admin panel and a badge next to the search bar.

You can customize any behaviour via the plugin object.

Customizing the view

Use php artisan vendor:publish --tag="filament-environment-indicator-views" to publish the view to the resources/views/vendor/filament-environment-indicator folder. After this you can customize it as you wish!

Visibility

By default, the package checks whether you have Spatie permissions plugin installed and checks for a role called super_admin. You can further customize whether the indicators should be shown.

use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;

$panel->plugins([
    EnvironmentIndicatorPlugin::make()
        ->visible(fn () => auth()->user()?->can('see_indicator'))
]);

Colors

You can overwrite the default colors if you want your own colors or need to add more. The ->color()method accepts any Filament's Color object or a closure that returns a color object.

use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;
use Filament\Support\Colors\Color;

$panel->plugins([
    EnvironmentIndicatorPlugin::make()
        ->color(fn () => match (app()->environment()) {
            'production' => null,
            'staging' => Color::Orange,
            default => Color::Blue,
        })
]);

Indicators

By default, both indicators are displayed on non-production environments. You can turn them off separately.

use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;
use Filament\Support\Colors\Color;

$panel->plugins([
    EnvironmentIndicatorPlugin::make()
        ->showBadge(false)
        ->showBorder(true)            
]);

Badge position

By default, badge position is \Filament\View\PanelsRenderHook::GLOBAL_SEARCH_BEFORE.

use Filament\View\PanelsRenderHook;
use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;

$panel->plugins([
    EnvironmentIndicatorPlugin::make()
        ->badgePosition(PanelsRenderHook::TOPBAR_LOGO_BEFORE)
]);

Git Branch

You can enable the display of the current git branch in the badge via ->showGitBranch(). This requires the exec() function to be enabled in your PHP configuration.

use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;
use Filament\Support\Colors\Color;

$panel->plugins([
    EnvironmentIndicatorPlugin::make()
        ->showGitBranch()                    
]);

Debug Mode Warning

You can enable a debug mode warning for every environment or just for production by using ->showDebugModeWarning()/->showDebugModeWarningInProduction()

use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin;
use Filament\Support\Colors\Color;

$panel->plugins([
    EnvironmentIndicatorPlugin::make()
        ->showDebugModeWarningInProduction()            
]);

Contributing

If you want to contribute to this packages, you may want to test it in a real Filament project:

  • Fork this repository to your GitHub account.
  • Create a Filament app locally.
  • Clone your fork in your Filament app's root directory.
  • In the /filament-environment-indicator directory, create a branch for your fix, e.g. fix/error-message.

Install the packages in your app's composer.json:

"require": {
    "pxlrbt/filament-environment-indicator": "dev-fix/error-message as main-dev",
},
"repositories": [
    {
        "type": "path",
        "url": "filament-environment-indicator"
    }
]

Now, run composer update.

Credits

统计信息

  • 总下载量: 728.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 144
  • 点击次数: 2
  • 依赖项目数: 11
  • 推荐数: 0

GitHub 信息

  • Stars: 143
  • Watchers: 4
  • Forks: 22
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固